marcan changed the topic of #asahi-dev to: Asahi Linux: porting Linux to Apple Silicon macs | General development | GitHub: https://alx.sh/g | Wiki: https://alx.sh/w | Logs: https://alx.sh/l/asahi-dev
r3n has joined #asahi-dev
amw has quit [Ping timeout: 272 seconds]
qyousef has quit [Ping timeout: 276 seconds]
qyousef has joined #asahi-dev
phiologe has quit [Ping timeout: 258 seconds]
phiologe has joined #asahi-dev
bgb has joined #asahi-dev
bgb has left #asahi-dev ["WeeChat 3.0.1"]
bgb has joined #asahi-dev
<bgb> I am curious about the m1n1.ld, there is a line: "_va_base = 0xFFFFFE0007004000;", How did we decide this specific address?
<modwizcode> I googled it and it turns up one result as an XNU thing
<bgb> I guess iBoot loads m1n1.macho as a standalone app, just as we execute hello demo under linux. question is why 0xFFFFFE0007004000?
brandas has quit [Read error: Connection reset by peer]
brandas has joined #asahi-dev
<modwizcode> Specifically line 342
<bgb> I got it, thanks
<bgb> seems lines 637-664 give more detailed info.
<modwizcode> Heh I didn't see that when I first looked at this file awhile back
<bgb> not quite clear about the whole picture, but got more info to understand why using this address to get control of M1
<modwizcode> Yeah I'm not suer if it honestly matters only marcan would know. As far as I know once iBoot kicks execution over to you, you're executing from a physical address and the virtual load address is nothing. I'm assuming that iBoot would relocate things using the virtual base address if you had any mach-o relocations, but that's now how M1N1 works (for good reason)
<modwizcode> That makefile for xnu is insane though, they seem to specify everything via linker arguments instead of using a linker script for anything
<marcan> bgb: it's the same as xnu, though I suspect "0" would work but I never tried it
<marcan> (back when I was writing that mach-o header thing I started out making it similar to xnu to eliminate errors, since I had to get that much to work blind)
<marcan> that address means nothing, for what it's worth
<marcan> for us, anyway
<marcan> it's just a hack because mach-o is a mildly brain-dead format that does not support the concept of physical addresses
<marcan> it's not even the real virtual address of xnu any more, thanks to kASLR
<marcan> so it's really a completely arbitrary number at this point, with no significance to anything whatsoever at runtime; I just don't know if iBoot has any restrictions on it
<marcan> basically it just means all addresses in the mach-o format are relative to that number
<marcan> and iBoot translates it to wherever the hell it wants in physical address space
anthonyo has joined #asahi-dev
anthonyo has quit [Client Quit]
_whitelogger has joined #asahi-dev
<bgb> maran: I saw more about m1n1.ld, the m1n1 code itself is linked at 0, then you tell iBoot which loads the m1n1.macho: please load m1n1 to vmaddr and transfer
VinDuv has joined #asahi-dev
<bgb> xnu kernel is linked at 0xFFFFFE0007004000 (according to xnu makefile...-Wl,-image_base,$(ARM64_LINK_ADDR)), so there is no reason to be wrong for m1n1 using this address
<bgb> not sure if this is reasonable. anyway, nice approach to convert elf to macho!
<marcan> bgb: vmaddr is not used for anything other than computing addresses
<marcan> iBoot loads m1n1 to wherever it wants, in fact it's randomized in a 32MB window every boot due to kASLR
<marcan> the only thing those vmaddrs are used for is internal to the mach-o format, and as a quirk, also as the base for some pointers passed from iBoot, but those are kASLR slid anyway so that base vmaddr isn't correct either, iBoot tells you the one it *actually* used
<marcan> I'm actually not even sure if virt_base is based on that address...
maor26 has joined #asahi-dev
<bgb> ok, I do notice the top_of_kernel_data of bootargs changes every time when transfered from iBoot
VinDuv has quit [Quit: Leaving.]
<marcan> yes, so does the m1n1 base address and certain bits of virt_base
mellotron1[m] has quit [Quit: Idle for 30+ days]
jrmuizel[m] has quit [Quit: Idle for 30+ days]
jinen[m] has quit [Quit: Idle for 30+ days]
robinp_ has joined #asahi-dev
robinp has quit [Ping timeout: 258 seconds]
robinp_ is now known as robinp
<bgb> so, that is why m1n1 startup code is written in PIC, and C files compiled with -fPIC.
<marcan> yes
robinp_ has joined #asahi-dev
robinp has quit [Ping timeout: 240 seconds]
bgb has quit [Ping timeout: 264 seconds]
zkrx has quit [Ping timeout: 276 seconds]
bgb has joined #asahi-dev
zkrx has joined #asahi-dev
bgb has quit [Ping timeout: 240 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 246 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 272 seconds]
<bastilian> After ordering a handful of USB-C cables, I did find one with SBU1/2 lines attached to my external hard drive. So I finally could play around with the serial console. :D so fun.
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 265 seconds]
odmir_ has joined #asahi-dev
odmir has quit [Ping timeout: 258 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 246 seconds]
bgb has joined #asahi-dev
bgb has left #asahi-dev [#asahi-dev]
acelogic has quit [Ping timeout: 240 seconds]
bgb has joined #asahi-dev
<bgb> marcan: can we disable HCR_EL2.E2H bit? I just wanted to clear this bit in m1n1_main, but failed
thestr4ng3r has quit [Read error: Connection reset by peer]
thestr4ng3r has joined #asahi-dev
snalty has joined #asahi-dev
thestr4ng3r has quit [Read error: Connection reset by peer]
thestr4ng3r has joined #asahi-dev
<jix> (I have no idea what that bit even is exactly, I just saw and remebered that mail)
<j`ey> jix: controls VHE = virtualisation host extensions
acelogic has joined #asahi-dev
<bgb> got it, thanks
<bgb> this seems conflict with arm architectue reference manual
carlosn has joined #asahi-dev
puhitaku has quit [Read error: Connection reset by peer]
narmstrong has quit [Read error: Connection reset by peer]
HeN has quit [Ping timeout: 246 seconds]
modmuss50 has quit [Read error: Connection reset by peer]
eric_engestrom has quit [Ping timeout: 246 seconds]
austriancoder has quit [Read error: Connection reset by peer]
diddledan has quit [Ping timeout: 265 seconds]
robher has quit [Ping timeout: 265 seconds]
sferrini has quit [Ping timeout: 260 seconds]
r1fl has quit [Ping timeout: 260 seconds]
brinly has quit [Read error: Connection reset by peer]
prusnak has quit [Read error: Connection reset by peer]
WhyNotHugo has quit [Write error: Connection reset by peer]
sirn has quit [Read error: Connection reset by peer]
arnd has quit [Read error: Connection reset by peer]
doof has quit [Read error: Connection reset by peer]
rann has quit [Read error: Connection reset by peer]
puhitaku has joined #asahi-dev
narmstrong has joined #asahi-dev
modmuss50 has joined #asahi-dev
austriancoder has joined #asahi-dev
sirn has joined #asahi-dev
prusnak has joined #asahi-dev
arnd has joined #asahi-dev
sferrini has joined #asahi-dev
diddledan has joined #asahi-dev
robher has joined #asahi-dev
brinly has joined #asahi-dev
eric_engestrom has joined #asahi-dev
HeN has joined #asahi-dev
WhyNotHugo has joined #asahi-dev
r1fl has joined #asahi-dev
bgb has quit [Ping timeout: 272 seconds]
rann has joined #asahi-dev
doof has joined #asahi-dev
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 240 seconds]
acelogic has quit [Remote host closed the connection]
bgb has joined #asahi-dev
<marcan> bgb: we cannot
<marcan> jix: that bit erases EL1, basically
<marcan> it means you can run a "normal" OS as EL2 because it aliases all the EL1 registers to EL2 registers
<marcan> basically E2H==0 means type 1 hypervisor, E2H==1 means type 2 hypervisor
<marcan> (you could do type 2 with E2H==0 but it would suck)
<jix> wasn't really asking, was just pointing out that even though I posted that mail, I'm not the right person for more info... :)
<marcan> bgb: and yes, this is a spec violation
<marcan> jix: yeah but you or someone else might still wonder :)
<marcan> bgb: just for the record, if you *could* clear E2H you'd have to change the mmu code, as things there work differently in those two modes
<jix> yeah, I'd have to read more about how arm does stuff in general to make sense of this (but I'm busy with other stuff)
bgb has quit [Ping timeout: 265 seconds]
acelogic has joined #asahi-dev
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 260 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 265 seconds]
l0bara has joined #asahi-dev
bgb has joined #asahi-dev
acelogic has quit [Ping timeout: 256 seconds]
vimal has quit [Remote host closed the connection]
bgb has quit [Ping timeout: 272 seconds]
vimal has joined #asahi-dev
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 246 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 272 seconds]
<never_released> marcan: I wonder if there's a chicken bit
<never_released> for this
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 265 seconds]
reispflanze[m] has quit [Quit: Idle for 30+ days]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 265 seconds]
<marcan> never_released: sounds unlikely though, why hardcode this on if not to simplify the implementation?
robinp_ has quit [Ping timeout: 240 seconds]
robinp has joined #asahi-dev
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 256 seconds]
l0bara42 has joined #asahi-dev
l0bara has quit [Ping timeout: 272 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 246 seconds]
VinDuv has joined #asahi-dev
bgb has joined #asahi-dev
arnd has quit [Read error: Connection reset by peer]
austriancoder has quit [Read error: Connection reset by peer]
arnd has joined #asahi-dev
austriancoder has joined #asahi-dev
bgb has quit [Ping timeout: 240 seconds]
acelogic has joined #asahi-dev
bgb has joined #asahi-dev
acelogic has quit [Remote host closed the connection]
acelogic has joined #asahi-dev
bgb has quit [Ping timeout: 272 seconds]
bgb has joined #asahi-dev
the-mentor has quit [Quit: The Lounge - https://thelounge.chat]
bgb has quit [Ping timeout: 264 seconds]
the-mentor has joined #asahi-dev
l0bara42 has quit [Ping timeout: 256 seconds]
l0bara has joined #asahi-dev
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 264 seconds]
acelogic has quit [Remote host closed the connection]
acelogic has joined #asahi-dev
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 246 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 246 seconds]
bgb has joined #asahi-dev
VinDuv has quit [Quit: Leaving.]
bgb has quit [Ping timeout: 256 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 240 seconds]
brandas has quit [Ping timeout: 264 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 240 seconds]
bsandro has quit [Ping timeout: 256 seconds]
bsandro has joined #asahi-dev
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 256 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 264 seconds]
bsandro has quit [Ping timeout: 256 seconds]
bsandro has joined #asahi-dev
bgb has joined #asahi-dev
r1fl has quit [Read error: Connection reset by peer]
r1fl has joined #asahi-dev
bgb has quit [Ping timeout: 272 seconds]
stemnic has quit [Ping timeout: 240 seconds]
Hakon has quit [Ping timeout: 240 seconds]
bgb has joined #asahi-dev
Hakon has joined #asahi-dev
bgb has quit [Ping timeout: 240 seconds]
stemnic has joined #asahi-dev
maor26 has quit [Ping timeout: 256 seconds]
bgb has joined #asahi-dev
bgb has quit [Ping timeout: 264 seconds]
amw has joined #asahi-dev