OSDev.org
https://forum.osdev.org/

error in paging page ?
https://forum.osdev.org/viewtopic.php?f=8&t=30906
Page 1 of 1

Author:  stdcall [ Wed Oct 12, 2016 6:38 am ]
Post subject:  error in paging page ?

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 ?

Author:  Techel [ Wed Oct 12, 2016 6:51 am ]
Post subject:  Re: error in paging page ?

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)

Author:  stdcall [ Wed Oct 12, 2016 7:00 am ]
Post subject:  Re: error in paging page ?

You're right I missed a parenthesis. thought the the casting to unsigned long * was after the multiplication.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/