loading kernel at any physical address

Vijay.Singh at nokia.com Vijay.Singh at nokia.com
Wed Dec 15 10:45:15 PST 2004


Hello all, for a project I am trying to figure out how to boot a FreeBSD kernel loaded at any physical address. Right now the locore.s magic works because the load addres (KERNLOAD) and (KERNBASE) are set such that

#define R(foo) ((foo)-KERNBASE)

macro is able to get the addresses before paging is enabled.

If the loadaddress information is not embedded in defines, then is the following solution expected to work:

	.globl	_loadaddress		/* should be at 16M aligned ??? */
	.set	_loadaddress,KERNBASE

and then:

NON_GPROF_ENTRY(btext)

        nop                             /* nops for 8 byte alignment */
        nop
        nop
        call 0f
0:
        mov     4(%ebp), %eax
        add     $-8, %eax               /* This is actual physical load addr */
        add     $-0x100000, %eax
        subl     %eax, _loadaddress     /* new kernbase w.r.t load addr */
                                        /* instead of standard 1MB reloc */

and then 

#define R(foo) ((foo)- _loadaddress)

One issue might be loadaddress over 16M, but for this problem we can assume that the processor has been in protected mode, so it has access to that space.

Any input on this is highly appreciated.

br
vijay




More information about the freebsd-hackers mailing list