Getting argv onto user stack


(David Robert Olsen) #1

In the recitation diagram, it shows that stackptr and argv are both pointers in kernel space, pointing to addresses on the stack.

However, enter_new_process requires a pointer from userspace to function. Would I be correct in assuming that the pointer to argv itself also has to be copied onto the user stack before passing it into enter_new_process?


(Geoffrey Challen) #2

No. The pointer gets passed back through a register.


(David Robert Olsen) #3

Simply passing a pointer into the register takes care of it being put into userspace?


(Geoffrey Challen) #4

No. The argv char ** pointer gets passed back through a register. It needs to point to the argv char * array, and all of those pointers to strings, which all need to be in user memory. It’s just the initial pointer that doesn’t get passed in memory but rather in a register.