exec()
To use exectest.c
, replace exec.c
with the copy of exec.c
in this directory.
(The only modification is the addition of print statements.)
Then run exectest
as a user program and observe the output. The actual program does nothing. The point is to observe how it's memory is setup during exec()
.
Your output should look like this:
$ exectest
exec:
finished loading program; sz: 0x84c
exec:
finished allocating stack; sz: 0x3000
exec:
Old page table entries:
pdx: 0, ptx: 3, ppage: df2c, present: 1, writable: 1, user: 1, encrypted: 0
pdx: 0, ptx: 2, ppage: df2d, present: 1, writable: 1, user: 0, encrypted: 0
pdx: 0, ptx: 1, ppage: dfbd, present: 1, writable: 1, user: 1, encrypted: 0
pdx: 0, ptx: 0, ppage: df74, present: 1, writable: 1, user: 1, encrypted: 0
exec:
New page table entries:
pdx: 0, ptx: 2, ppage: dedf, present: 1, writable: 1, user: 1, encrypted: 0
pdx: 0, ptx: 1, ppage: dee0, present: 1, writable: 1, user: 0, encrypted: 0
pdx: 0, ptx: 0, ppage: dee2, present: 1, writable: 1, user: 1, encrypted: 0
exec:
Value of address 0x400 before switchuvm: 0xc974c085
exec:
Value of address 0x400 after switchuvm: 0xf889d2be