Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Initial process start



Hello,

I'm porting a compiler to NetBSD/amd64 and would like to know about the
initial process state. Using gdb, I've surmised that rbx points to argv
and envp. The process also gets a stack and I guess auxv is somewhere in
there. I also see that rax, rcx, rdx, rsi, rdi, and rbp are set to zero.

But what are the other registers set to? Registers r8-r15 seem to change
semi-randomly from one exec to another. Some examples:

r8    0x18            0x18            0x18            0x18
r9    0x72c190ca7c51  0x75b2a6528c51  0x714ff68b3c31  0x747c2deccc51
r10   0x0             0x0             0x0             0x0
r11   0x246           0x246           0x246           0x246
r12   0x72c1909c9000  0x75b2a6450000  0x714ff6805000  0x747c2de05000
r13   0x0             0x0             0x0             0x0
r14   0x72c190c9d240  0x75b2a651e240  0x714ff68a9240  0x747c2dec2240
r15   0x7f7fff500ea0  0x7f7fff32baa0  0x7f7fff837b50  0x7f7fffedda20

To my eye, 0x18 looks like a CPL=0 segment selector and 0x246 looks like
it came from rflags. So are these just values left over from the kernel,
nothing I should use? Can I rely on the pointer in rbx, and is this
documented somewhere?

Regards,

-- 
Göran Weinholt   | https://weinholt.se/
Debian developer | 73 de SA6CJK


Home | Main Index | Thread Index | Old Index