Page 1 of 1

AT( ADDR(.__mbHeader) - What should I put in that ?

Posted: Sun Aug 08, 2010 8:28 pm
by van7hu
Hi all,I have read about error 13:http://wiki.osdev.org/Grub_Error_13
Hell,in the last line AT( ADDR(.__mbHeader) - YOUR_KERNEL\'S_VIRTUAL_OFFSET_HERE )
What is "YOUR_KERNEL\'S_VIRTUAL_OFFSET_HERE )" ?
sorry for my stupid question , but I am completely new to Osdev

Re: AT( ADDR(.__mbHeader) - What should I put in that ?

Posted: Sun Aug 08, 2010 9:58 pm
by gerryg400
As an example, you might have something like this

Code: Select all

	.text 0xc0000000 : 
	  AT ( 0x100000 ) ALIGN (0x1000)
	  { *(.text) } 

This means that the code will be loaded by Grub at 0x100000. However, when paging is enabled, the code will actually execute at 0xc0000000. The value of 'YOUR_KERNEL'S_VIRTUAL_OFFSET_HERE' is the address that it is linked at (0xc0000000) minus the address that Grub loads it at (0x100000). In the above example the difference is 0xbff00000.

Code: Select all

YOUR_KERNEL'S_VIRTUAL_OFFSET_HERE = Virtual address - Physical address