IRC channel logs
2025-12-29.log
back to list of logs
<damo22>x86_64/boothdr.S gives some clues how to do it <almuhs>damo22: if i remember well, the percpu area change in 64-bit <damo22>there are MSRs for base address of GS <damo22>GS =0068 00000000810c0000 000f0000 00209300 DPL=0 DS [-WA] <damo22>i cant get the top 32 bits of the base address to be ones <almuhs>i don't know. I don't have enough knowledge about this <damo22>ive almost solved this, currently it loads GS correctly but wipes it out when it reloads gdt <damo22>yeah i cant seem to set the top 32 bits of base address for GS seg without using the MSR <damo22>ok now it is stuck during first printf trying to do CPU_NUMBER() using gs <damo22>GS =0000 0000000000000000 ffffffff 00c00000 <damo22>it looks like something reset the base address of gs <damo22>167 #define SET_KERNEL_SEGMENTS(reg) \ <damo22>168 ud2 /* TODO: use swapgs or similar */ <damo22>interesting, i got a double fault <damo22>swapgs is not nestable, so how do i know what state its in? <damo22>ie, calling swapgs once puts the kernelgs -> gs but if i get an interrupt before swapping it back it will be out of sync? <damo22>GS =0000 ffffffff810c0000 ffffffff 00c00000 <damo22>hmm i tried setting both gs and kernelgs to the percpu area pointer <damo22>GS =0068 ffffffff810c0000 000f0000 00209300 DPL=0 DS [-WA] <damo22>hmm GS =0068 ffffffff810c0000 00000000 00209300 DPL=0 DS [-WA] <damo22>this looks correct, as the base address of GS points to &percpu_array[0] <damo22>but every time it tries to print a character, it double faults <damo22>(gdb) x &percpu_array[0].active_stack <damo22>0xffffffff810c04a8 <percpu_array+1192>: 0x00000000 <damo22>trap_from_kernel () at ../x86_64/locore.S:716 <damo22>716 pushq %rbx /* save old stack */ <damo22>pushing to that stack will fault <damo22>why am i getting a trap_from_kernel before the first thread is executed? <damo22>714 movq CX(EXT(kernel_stack),%rdx),%rsp <damo22>716 pushq %rbx /* save old stack */ <damo22>both percpu_array[0].active_stack and kernel_stack[0] == 0x0 so this faults <damo22>i cant put a breakpoint near the start of gnumach because the segmentation wont let me insert the breakpoint <damo22>232 s = simple_lock_irq (&kmsg_lock); <damo22>=> 0xffffffff8103d844 <+0>: lock addl $0x0,(%esp) <damo22>how can memory barrier instruction double fault? <damo22>$3 = (void *) 0xffffffff810f3d20 <double_fault_stack+3488> <damo22>=> 0xffffffff8103d844 <+0>: lock addl $0x0,(%esp) <damo22> 0xffffffff8103d84b <+7>: mov %gs:0xc,%edx <damo22> 0xffffffff8103d853 <+15>: mov $0x7,%eax <damo22> 0xffffffff8103d858 <+20>: xchg %eax,-0x7ef19540(,%rdx,8) <damo22>si never returns because it double faults in a loop <damo22>since esp is not the full 64 bit address <damo22>Cannot access memory at address 0x1000472 <damo22>then double fault due to GS base resetting to 0 <rrq>is it "seriously bad" for gnumach to occupy some low-memory region? For a spectator it looks like that would simplify matters... <damo22>.section .boot.text and .boot.data <damo22>ive got smp64 almost running, it prints something on console at least <damo22>maybe i should clean up what ive got and mail it in <damo22>its better than not being able to compile smp on 64 bit <damo22>im not sure how to handle swapgs yet <rrq>wish I could help :) but I still know too little about it.. <damo22>im now testing this branch to make sure no regressions on i386 <rrq>thanks. yes, it's more that I'm lacking the background knowledge. I spent too long time with a Cortex-A53 this year. <damo22>arm is probably a good thing to become familiar with <damo22>i feel like i am wasting time with x86 <azert>they mention that it needs special tests for interrupts <azert>they provide a “cheap” test and an “expensive” test, that is require for non mascable <damo22>it seems complex because i dont know the stack setup for hurd <damo22>like what should the stack look like at every entry and exit from the kernel <damo22>i could start by doing the expensive check first always <damo22>because that doesnt care about the stack layout <damo22>i cant find docs on msr reading/writing for gsbase <azert>although there are good chances that the stack will look like it does in Linux <damo22>i wrote something but it might be wrong <damo22>apparently you have to set ebx = 1 then read the msr <damo22>is there anything special for writing? <paculino>I recently revived an old laptop and have some questions maybe; is there a list of hardware which people have attempted bare-metal installs on? <azert>damo22: ebx is set to one to indicate that it is already in the kernel <azert>or to zero if it comes from user space <damo22>paculino: x200 works, x230 works too except no ethernet with netdde <paculino>I do not have direct access to a router anyway, so ethernet would be to lan at best <azert>paculino: did you check the wiki? <paculino>I was unaware of a wiki, only mailing lists and here <paculino>It's a Toshiba Satellite from 2014 based on the bios <azert>then you can probably try the 64 bit <damo22>i think any intel hw from that era should probably work <paculino>Nearly the same era as x230 at least, but idk <paculino>Yeah, that's what I was saying elsewhere but everyone insisted 'legacy' <damo22>paculino: i suggest upgrading the bios from the vendor website, there are probably bugs that were fixed <paculino>The specs are double to triple a netbook from 2022 <paculino>I believe it is as updated as possible since it seemed to die in 2020 <paculino>Yeah, I did not know enough to fix it then, but now it is obvious minor stuff <paculino>Windows said the disk was no good, but I got devuan now no problem <damo22>do you have a second disk you can wipe? <damo22>it may be easier to install to a dedicated disk <paculino>I just have to figure out which unlabelled disk in this stack of dvd and cd is big enough (they are all blank) <paculino>The sata port is a bit sketchy with its connections to the motherboard, so I don't know if I want to risk changing the plug, but I will keep that in mind for the future <paculino>I'm probably not making much sense with that... <damo22>are you worried the connector will snap off? <damo22>i have a memory address just above 1MB that i cannot seem to access: <damo22>Cannot access memory at address 0x1000472