OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Apr 23, 2017 7:52 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: error in paging page ?
PostPosted: Wed Oct 12, 2016 6:38 am 
Offline
Member
Member

Joined: Thu Mar 14, 2013 1:30 am
Posts: 52
In http://wiki.osdev.org/Paging#Manipulation

I think the following line is wrong here:
Code:
    unsigned long * pt = ((unsigned long *)0xFFC00000) + (0x400 * pdindex);

I think it needs to be
Code:
    unsigned long * pt = ((unsigned long *)0xFFC00000) + (0x1000 * pdindex);

Am I wrong ?


Top
 Profile  
 
 Post subject: Re: error in paging page ?
PostPosted: Wed Oct 12, 2016 6:51 am 
Offline
Member
Member

Joined: Fri Jan 30, 2015 4:57 pm
Posts: 213
Location: Germany
When adding to pointers the offset is multiplied by the pointee's size:
Code:
int *p = ...
p += 5; //adds 5*sizeof(int)

short *p = ...
p += 3; //add 3*sizeof(short)


Top
 Profile  
 
 Post subject: Re: error in paging page ?
PostPosted: Wed Oct 12, 2016 7:00 am 
Offline
Member
Member

Joined: Thu Mar 14, 2013 1:30 am
Posts: 52
You're right I missed a parenthesis. thought the the casting to unsigned long * was after the multiplication.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group