Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Dec 2004 22:27:33 +0300
From:      Igor Shmukler <shmukler@mail.ru>
To:        Vijay.Singh@nokia.com
Cc:        hackers@freebsd.org
Subject:   Re: loading kernel at any physical address
Message-ID:  <E1Ceeo9-000EFu-00.shmukler-mail-ru@f21.mail.ru>
In-Reply-To: <E40595640FD457418D8F9005C2BEC8496456A2@mvebe001.americas.nokia.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I think this might be somewhat off topic, but to support superpages you probably want kernel to be aligned on 4MB boundary.

Also, Mach had macros for alignment. I browsed code and it seems there are macros in i386/include/asmacros.h
Perhaps I am missing something, but I don't see why would you want to align with NOPS.


-----Original Message-----
From: <Vijay.Singh@nokia.com>
To: <hackers@freebsd.org>
Date: Wed, 15 Dec 2004 10:43:45 -0800
Subject: loading kernel at any physical address

> 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?E1Ceeo9-000EFu-00.shmukler-mail-ru>