[GSoC - x86_64] Using FreeBSD's UEFI loader for RTEMS static binaries

Chris Johns chrisj at rtems.org
Thu Jun 14 08:04:54 UTC 2018



On 14/6/18 4:33 pm, Jan.Sommer at dlr.de wrote:
> 
>> -----Original Message-----
>> From: devel [mailto:devel-bounces at rtems.org] On Behalf Of Chris Johns
>> Sent: Thursday, June 14, 2018 7:56 AM
>> To: joel at rtems.org; Amaan Cheval
>> Cc: RTEMS
>> Subject: Re: [GSoC - x86_64] Using FreeBSD's UEFI loader for RTEMS static
>> binaries
> 
> [...]
>>>     >>
>>>     -------------------------------------------------------------------------------------
>>>     >>
>>>     >> What I need input on:
>>>     >> - Right now, we use the following RTEMS code for testing:
>>>     >>
>>>     >> int main() {
>>>     >>   while(1) {}
>>>     >> }
>>>     >>
>>>     >
>>>     > It's not really an RTEMS code, it is a C program (ktest.c) compiled
>>>     > with the RTEMS-flavored toolchain, right?
>>>
>>>     Yeah, for now that's right. I'm going to conduct the same gdb based
>>>     debug-stepping style test for RTEMS setting boot_card as the entry
>>>     point soon - for now, it crashes QEMU with:
>>>
>>>     qemu: fatal: Trying to execute code outside RAM or ROM at
>> 0x00000000000b0000
>>>
>>>     RAX=00000000006004c0 RBX=00000000006003d8 RCX=0000000037f36000
>>>     RDX=0000000000400000
>>>     RSI=0000000004000000 RDI=0000000000000180 RBP=00000000006003d8
>>>     RSP=000000003c589fb8
>>>     ...
>>>
>>>     I see that it reaches that stage even from some code it ought not to
>>>     be executing, so I'll look into what that may be about.
>>
>> Hmm.
>>
> 
> I don't know if that is of any help, but when I was starting to use the i386-bsp with our build system I had a similar issue.
> The reason was that I forgot to use the linker flags (-Wl,-Ttext,0x00100000) used in the RTEMS makefiles in our build setup.
> Maybe something similar has to be done for x86_64 too in order to relocate the text section to a more sensible location?


Good point. I wonder how the FreeBSD kernel is linked...

https://github.com/freebsd/freebsd/blob/master/sys/conf/ldscript.amd64

?

Chris


More information about the devel mailing list