Discussion:
Zero filling the stack
(too old to reply)
Paolo
2011-07-20 14:45:09 UTC
Permalink
So whenever I start a program the first address that occurs the page
fault is the stack address. The prof told me that I should zero-filled
all the pages in the stack so I should use the same method in
load_segment to zero-fill one page at a time. But since the info from
the elf segments cant be used (probably) ...

1. Whats the offset of it? zero?
2. How to get the memory size of the stack?
3. Do i allocate and load 1 page at a time or all pages in the stack?
4. Do I update the page fault zero every time it loads the stack pages?
Greg Wang
2011-07-20 22:20:50 UTC
Permalink
As long as I can tell,

1. yes, zero
2. each page/frame should have the same size
3. prob one page at a time
4. you only fill up the page with zero once. you count it as reload it
later.

"Paolo" 写入消息 news:j06pll$n71$***@rumours.uwaterloo.ca...

So whenever I start a program the first address that occurs the page
fault is the stack address. The prof told me that I should zero-filled
all the pages in the stack so I should use the same method in
load_segment to zero-fill one page at a time. But since the info from
the elf segments cant be used (probably) ...

1. Whats the offset of it? zero?
2. How to get the memory size of the stack?
3. Do i allocate and load 1 page at a time or all pages in the stack?
4. Do I update the page fault zero every time it loads the stack pages?
cs350
2011-07-21 20:24:46 UTC
Permalink
1. the stack segment starts at the 0x800... boundary and grows down (so
the first byte is actually 0x800... - 1). There are a bunch of constants
defined for this like USERTOP.

2. you define the memory size of the stack, look at dumbvm.c

3. one page at a time

4. if you have to load a page and it's a zeroed page, then increment the
counter

-Alex
So whenever I start a program the first address that occurs the page fault is
the stack address. The prof told me that I should zero-filled all the pages
in the stack so I should use the same method in load_segment to zero-fill one
page at a time. But since the info from the elf segments cant be used
(probably) ...
1. Whats the offset of it? zero?
2. How to get the memory size of the stack?
3. Do i allocate and load 1 page at a time or all pages in the stack?
4. Do I update the page fault zero every time it loads the stack pages?
Loading...