Paging Code of James Molloy Tutorial

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ArunRavi
Posts: 2
Joined: Tue Sep 01, 2020 2:40 am

Paging Code of James Molloy Tutorial

Post 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
Octocontrabass
Member
Member
Posts: 5572
Joined: Mon Mar 25, 2013 7:01 pm

Re: Paging Code of James Molloy Tutorial

Post 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.
ArunRavi
Posts: 2
Joined: Tue Sep 01, 2020 2:40 am

Re: Paging Code of James Molloy Tutorial

Post by ArunRavi »

Hey, thanks a ton!
Post Reply