Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Dec 2004 10:43:45 -0800
From:      <Vijay.Singh@nokia.com>
To:        <hackers@freebsd.org>
Subject:   loading kernel at any physical address
Message-ID:  <E40595640FD457418D8F9005C2BEC8496456A2@mvebe001.americas.nokia.com>

next in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E40595640FD457418D8F9005C2BEC8496456A2>