kernel load address

Hong MingJian superhaar at 263.sina.com
Mon Feb 9 19:03:57 PST 2004


Hi all,
   When reading locore.s, I have the following question.

In the locore.s, there's a macro R defined as
		 #define R(foo)	 ((foo)-KERNBASE)
where KERNBASE equals to 0xC0000000.

But in the sys/conf/ldscript.i386, it reads
		 SECTIONS
		 {
			. = kernbase + 0x00100000 + SIZEOF_HEADERS;
			.....
		 }
The kernel is loaded at 0x00100000 by boot2 or loader with program
header stripped. So, how the R macro can still work? 

I think it should be defined as `((foo)-KERNBASE-SIZEOF_HEADERS)' or
the ldscript.i386 should be modified to
			. = kernbase + 0x00100000;

I refers to the ld script for Linux i386 kernel(vmlinux.lds), it reads
		 SECTIONS
		 {
			. = 0xC0000000 + 0x100000;
			..........
		 }

Thanks.



More information about the freebsd-hackers mailing list