-
Notifications
You must be signed in to change notification settings - Fork 1
_start call ABI #13
Comments
I'd prefer not passing environment variables, since that then requires macro hackery to get the environment variables cross-platform, besides the existing hackery required to use the variables. |
Well, there needs to be a way to get environment variables for, at the very least, |
Yeah, I'm going to have to recommend a syscall. I definitely do not recommend passing environment variables to |
Any comment on the other two (argc and argv) being passed into start. |
I think that sounds good, as they're more likely than not going to be used. |
Well, they need to be available to be passed into main. My question is if they should be in rdi and rsi (like Sys-V) or just store them on the stack like unix does and glibc's crt1.S handles. |
Probably put them on the stack so that initialization can do other things (which, it almost always will) without needing to specifically push rdi and rsi. |
Apparently Sys-V specifies this as well, so we should probably conform with it. |
This does not need to be fully decided until we are at userspace, but it is probably a good idea to decide on this now.
Basically, how should we call the entry point of user applications, or of the interpreter when there is a PT_INTERP segment.
Obviously, we need to store the arguments on the stack before the function, and then an array of pointers to them. Should we then push a pointer to that array, or pass it in rdi/rsi (if so, do we pass argc first in rdi?). Should we pass environment variables in the same way, or provide a system call to access them.
I'd note that there really isn't an "incorrect" way of doing this, since we'd need assembly anyways to far jmp into user code with CPL=3.
The text was updated successfully, but these errors were encountered: