IRC channel logs

2023-05-22.log

back to list of logs

<stikonas>oriansj: can you merge this https://github.com/oriansj/M2libc/pull/45 ?
<stikonas>I'll switch all risc-v defines to lowercase so that it mathes more those new x86 define style and also the ones I'm using in riscv64/mescc
<stikonas>(more repos will need updates but M2libc needs to be merged first)
<oriansj>stikonas: merged
<stikonas>oriansj: part 2 https://github.com/oriansj/M2-Planet/pull/55
<stikonas>by the way, I ran stage0-posix-riscv64 with all of this to completion
<stikonas>riscv32 needs a bit more work, so I'll probably finish stage0-posix-riscv* changes tomorrow...
<stikonas>but those I can merge myself anyway
<oriansj>stikonas: merged
<stikonas>thanks!
<emilytrau[m]>janneke: thanks for merging that change!
<fossy>yes, of course stikonas[m], it was rickmasters who did all the hard work to get this in - huge props to rickmasters :D
<janneke>stikonas[m]: i've bisected the scaffold/hello.c problem using this silly script:
<janneke> https://gitlab.com/janneke/mes/-/tree/wip-riscv/bisect.sh
<janneke>the problem is in _write (# Defining function _write)
<janneke>This: ld_____%a0,-0x08(%fp)
<janneke>now looks like
<janneke>rd_a0 rs1_fp !0x08 ld
<janneke>note the negative sign has been dropped
<janneke>it should be something like
<janneke>rd_a0 rs1_fp !-0x08 ld
<janneke>but that doesn't compile
<janneke>hex2 says: Target label -0x08 is not valid
<stikonas[m]>janneke: oh I must have missed it yesterday
<janneke>ah, but this works...
<janneke>rd_a0 rs1_fp !-8 ld
<janneke>weird, that means we cannot use hex!
<stikonas[m]>I'll tesok, let's switch to decimal
<stikonas[m]>Hex should work
<stikonas[m]>But maybe not for negative numbers
<stikonas[m]>Let me check M1 source
<janneke>ACTION really likes how oriansj created something that can sometimes be bisected trivially
<janneke>stikonas[m]: yeah, that's for negative numbers
<janneke>stikonas[m]: the !-0x08 => !0x08 oversight also happened consistently elsewhere, of course
<janneke>lib/linux/riscv64-mes-m2/syscall.c, eg
<janneke>it would be great if we could do that (bisecting) mix-and-matching also with M2-Planet generated M1 and MesCC-generated M1; that's (much) more tricksy to do if it works at all
<stikonas[m]>Hmm yes...
<stikonas[m]>It fails to detect that number is hex
<stikonas[m]>As it starts with - and not 0x
<stikonas[m]>Might be fixable...
<stikonas[m]>janneke: decimal is in else block here https://github.com/oriansj/M2libc/blob/main/bootstrappable.c#L149
<janneke>stikonas[m]: this seems to work:
<janneke>rd_a0 rs1_fp !0x-08 ld
<stikonas[m]>Oh!
<janneke>not sure if that might be even "more correct"
<stikonas[m]>Maybe let's fix mescc-tools instead
<stikonas[m]>!0x-8 is just wrong even if it works
<janneke>stikonas, reading _write.c, what do you think about:
<janneke>- asm ("rd_a7 !64 addi"); // SYS_write
<janneke>+ asm ("rd_a7 !64 addi #SYS_write");
<stikonas>addi has to be at the end
<stikonas>if that works
<stikonas>but I don't know it it does
<stikonas>this is read by M2-Planet?
<stikonas>if yes, then oriansj suggested
<stikonas> asm ("rd_a7 SYS_write "addi")
<stikonas>though his SYS_write already includede quotes around the number
<janneke>it works, it's just a comment
<stikonas>oh yes
<stikonas>sorry missed that you are still passing !64
<stikonas>janneke: I'll take a look at negative hexes later, need to run to work soon
<janneke>stikonas, np and there's no hurry!
<janneke>yeah, still using !64; just making the M1 better to read -- dunno
<stikonas>also need to make sure which is the correct way
<stikonas>need to find some specs
<stikonas>it might be that 0x-8 is the correct
<stikonas>no, python accepts only -0x8
<janneke>yeah, i'm not sure either
<stikonas>but not 0x-8
<janneke>python! bah
<janneke>guile accepts #x-33
<janneke>(add a winky there)
<stikonas[m]>GCC is the one we need to test...
<janneke>stikonas[m]: yeah, gcc says it's -0x03 and rejects 0x-03
<oriansj>janneke: I don't see much advantage for hex offsets for risc-v as unlike x86, it has little mapping to the resulting instruction due to how the encoding is jumbled.
<janneke>oriansj: sure, fair enough
<stikonas[m]>And positive ones are supported...
<stikonas[m]>So you could still do something like 0xFFFF
<janneke>yeah
<Piraty>ACTION boatstrips