Page 1 of 1

Paging Code of James Molloy Tutorial

Posted: Tue Sep 01, 2020 2:53 am
by ArunRavi
Hello everyone,

I was going through the paging code given by the James Molloy tutorial. I realized that in the init-paging function, the total memory is said to be 16MB, thus the total number of frames should be 4096 (given each frame is 4KB big). However, the frames bitmap is only 1024 bits large instead of 4096.
Shouldn't the line

Code: Select all

memset(frames, 0, INDEX_FROM_BIT(nframes));
be

Code: Select all

memset(frames, 0, INDEX_FROM_BIT(nframes)*4);
where nframes is equal to 4096 (0x1000), and the INDEX_FROM_BIT macro returns nframes/32, 128 in this case.

Link to James Molloy Paging Tutorial - http://www.jamesmolloy.co.uk/tutorial_h ... aging.html

Re: Paging Code of James Molloy Tutorial

Posted: Fri Sep 11, 2020 8:31 pm
by Octocontrabass
We have a nice list of known bugs in that tutorial.

I think you've found another bug to add to that list.

Re: Paging Code of James Molloy Tutorial

Posted: Sat Sep 12, 2020 2:21 am
by ArunRavi
Hey, thanks a ton!