error in paging page ?

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
stdcall
Member
Member
Posts: 78
Joined: Thu Mar 14, 2013 1:30 am

error in paging page ?

Post by stdcall »

In http://wiki.osdev.org/Paging#Manipulation

I think the following line is wrong here:

Code: Select all

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

Code: Select all

    unsigned long * pt = ((unsigned long *)0xFFC00000) + (0x1000 * pdindex);
Am I wrong ?
“Meaningless! Meaningless!”
says the Teacher.
“Utterly meaningless!
Everything is meaningless.” - Ecclesiastes 1, 2

Educational Purpose Operating System - EPOS
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: error in paging page ?

Post by Techel »

When adding to pointers the offset is multiplied by the pointee's size:

Code: Select all

int *p = ...
p += 5; //adds 5*sizeof(int)

short *p = ...
p += 3; //add 3*sizeof(short)
stdcall
Member
Member
Posts: 78
Joined: Thu Mar 14, 2013 1:30 am

Re: error in paging page ?

Post by stdcall »

You're right I missed a parenthesis. thought the the casting to unsigned long * was after the multiplication.
“Meaningless! Meaningless!”
says the Teacher.
“Utterly meaningless!
Everything is meaningless.” - Ecclesiastes 1, 2

Educational Purpose Operating System - EPOS
Post Reply