IRC channel logs

2022-08-22.log

back to list of logs

<stikonas>I'll probably fix some technical debt in current stage0-uefi programs before working on M0.efi
<stikonas>and possibly trial more redable defines that rickmaster suggested
<stikonas>oriansj, rickmasters: how about https://paste.debian.net/1251261/
<stikonas>for more complicated programs we might need to disambiguate between some commands, e.g. jmp8 and jmp32 but should be fairly obvious
<oriansj>well it does look pretty close to NASM assembly so it should be easy to read for anyone familiar with NASM
<stikonas>yes, that was my goal
<stikonas>I've just pushed catm conversion to stage0-uefi
<stikonas> https://git.stikonas.eu/andrius/stage0-uefi/commit/3528be5b2b5c9ba40f47481411d80f4094fc16aa
<stikonas>and even somebody not yet familiar with NASM is likely to first look at C prototype, then look at .S prototype and then M1, hex2, hex0
<oriansj>and I do like your position independent work on AMD64
<oriansj>I wish I thought to do that when I first went that route; it is just a much better idea
<stikonas[m]>Well, at least in hex2.hex1 it makes a lot if sense
<stikonas[m]>No need to calculate absolute addresses that hex1 doesn't support
<oriansj>indeed
<theruran>I was wondering how PIC is done in assembly. I thought it may be related to a problem I am experiencing with Jitawa LISP. But both my machines should be using KSLR, and both binaries are built with musl-libc. On my Intel machine, executing any procedure in Jitawa causes it to crash on an address boundary violation.
<theruran>again, it's not necessarily something I have the time to track down. but it is frustrating to run into this stuff and also not know the cause
<stikonas[m]>PIC in assembly is done by using relative displacements
<stikonas[m]>E.g. load label 64 bytes ahead rather than load address 0x612345
<muurkha>usually assemblers do this for you though
<muurkha>like, you don't have to put "64" in your assembly code, or even "0x612345"; you just put a label in there, and the assembler (or linker!) does the math
<muurkha>not sure how Jitawa handles its code generation, but it's common for JITs to have a relocation layer that does the analogous thing
<stikonas>well, at least on x86_64 you do need some work, e.g. you need to specify mov rax, [rip+label] (note rip+) part
<muurkha>yeah, that's true. but I think amd64 is atypical here. people with broader experience like oriansj can correct me