Discussion:
Load User Program
(too old to reply)
c***@CSIC.UMD.EDU
2005-11-05 23:43:33 UTC
Permalink
/* Find maximum virtual address */
for (i = 0; i < exeFormat->numSegments; ++i) {
struct Exe_Segment *segment = &exeFormat->segmentList[i];
ulong_t topva = segment->startAddress + segment-
sizeInMemory; /* FIXME: range check */
if (topva > maxva)
maxva = topva;
}

/* Determine size required for argument block */
Get_Argument_Block_Size(command, &numArgs, &argBlockSize);

I am not sure what the above code does. I am guessing it is
finding the maximum vitual address for the code/text segment,
which is later passed on Create_User_Context

Also, for passing parameters for format_argument_block

Should the first argument be the physical address of the page
which corresponds to the base of linear address page of args
which is 0xffffff - Sizeofargumentblock (rounded to a page ).

and the second to argument to same function should simply be
0xffffff - Sizeofargumentblock (rounded to a page ).

Please let me know if i am on the right track
Iulian Neamtiu
2005-11-05 23:58:51 UTC
Permalink
Post by c***@CSIC.UMD.EDU
/* Find maximum virtual address */
for (i = 0; i < exeFormat->numSegments; ++i) {
struct Exe_Segment *segment = &exeFormat->segmentList[i];
ulong_t topva = segment->startAddress + segment-
sizeInMemory; /* FIXME: range check */
if (topva > maxva)
maxva = topva;
}
/* Determine size required for argument block */
Get_Argument_Block_Size(command, &numArgs, &argBlockSize);
I am not sure what the above code does. I am guessing it is
finding the maximum vitual address for the code/text segment,
which is later passed on Create_User_Context
Yes, that's right. The highest virtual address, rounded to page size
represents the end of code/data segment.
Post by c***@CSIC.UMD.EDU
Also, for passing parameters for format_argument_block
Should the first argument be the physical address of the page
which corresponds to the base of linear address page of args
which is 0xffffff - Sizeofargumentblock (rounded to a page ).
and the second to argument to same function should simply be
0xffffff - Sizeofargumentblock (rounded to a page ).
Read the parameter description in argblock.c
2 and 4 are straightforward. 1 and 3 are tricky, eh ?
Try to understand what Format_Argument_Block() does, how arguments are
passed to the user program and then remember the
picture from recitation (or check the virtual adress layout in the project
description) as to what kind of addresses (kernel/user ?
logical/linear ?) go in there.
You might want to look at Setup_User_Thread() in kthread.c and _Entry()
in libc/entry.c.


Iulian

Loading...