c***@CSIC.UMD.EDU
2005-11-05 21:59:13 UTC
"As a suggestion, do this as follows: calculate the size of the
text and data segment of the process as is done now, without
including the size of the stack (but do round to PAGE_SIZE,
though), and Malloc it. Load the program into this memory, as
now. Then copy the image, page by page into the newly allocated
pages. Then allocate two pages of memory at the end of the
virtual address range (i.e. the last two entries in the last page
table). One is for the arguments, the other one is for stack.
Make sure the flags bits in both the page directory and page table
entries allow user mode access (contain VM_USER flag)"
1) Isnt the Malloc already done for us inside Create_User_Context?
2) The suggestion above is to copy page by page. Are we only
copying the code/text segment ( as we do not include the stack
size and argBlockAddr anymore ).
So in essence, nothing changes untill the very
end of the load_user_program of userseg.c and then at the end
before returning we allocate the pageTables and setup the
page directory. (page by page copying for text/code segment )
and simply allocating pages at the top for args and stack.
Please let me know if i am missing something here
text and data segment of the process as is done now, without
including the size of the stack (but do round to PAGE_SIZE,
though), and Malloc it. Load the program into this memory, as
now. Then copy the image, page by page into the newly allocated
pages. Then allocate two pages of memory at the end of the
virtual address range (i.e. the last two entries in the last page
table). One is for the arguments, the other one is for stack.
Make sure the flags bits in both the page directory and page table
entries allow user mode access (contain VM_USER flag)"
1) Isnt the Malloc already done for us inside Create_User_Context?
2) The suggestion above is to copy page by page. Are we only
copying the code/text segment ( as we do not include the stack
size and argBlockAddr anymore ).
So in essence, nothing changes untill the very
end of the load_user_program of userseg.c and then at the end
before returning we allocate the pageTables and setup the
page directory. (page by page copying for text/code segment )
and simply allocating pages at the top for args and stack.
Please let me know if i am missing something here