How to get amd64efi BSP running.
Karel Gardas
karel at functional.vision
Sun Apr 16 21:56:49 UTC 2023
Folks,
I just send my amd64efi BSP results for review. One of the commits (with
BSP actually) awaits moderator approval due to size so before it gets in
let me add few remarks about how to make that BSP working on either Qemu
or real hardware.
CAVEAT: We have serious issue somewhere between kernel, newlib and gcc
which causes SSE aligned isns to work on unaligned data causing general
protection fault. This issue is serious and needs to be investigated in
the future by anyone working on amd64. To workaround the issue I did:
- few "fixes" here and there as required by GP crash reports on
hello/ticker/malloctest tests. Those are only tests I have working here.
The patch for those fixes is attached. This is *NOT* something for
review or commit, this is just *WORKAROUND* to get interested people up
& running!
- unfortunately the issue above not only affects RTEMS kernel, but also
tools' newlib. Hence there is a need to build a new newlib. I simply
obtained newlib from git as the 6/rtems-x86_64 is pretty close to HEAD
of newlib anway and compile that with RTEMS GCC (installed by RSB). When
this is compiled I touched newlib/libc/stdio/findfp.c and recompile it
again, but this time with adding '-mgeneral-regs-only' GCC option. This
is needed since unalignment of data happens when using this:
30
31 __FILE __sf[3];
32
and the GCC does not have any attribute which would help with this
unless the code is rewritten to get rid of array construct here.
Anyway, using only general purpose regs here is quick and easy workaround...
And that's about all needed to get hello/ticker/malloctest working. Just:
- configure (config file defaults should be more or less sane)
- build
- either copy test.exe to real hardware with GRUB setup or
- use tools' grub to generate EFI-based GRUB image for you and use Qemu
virtual drive/dir support to boot from it directly.
Note: the configure provides plethora of options especially for EFI
console. You may also use BSP's command line arguments:
graphic_mode=<number>
or
text_mode=<number>
this is especially useful when seeing well nothing on the target platform.
Tested platforms:
- Qemu 7.2.0
- Kontron D3598-B
- Kontron D3641-S (only graphic_mode works here, when text is involved I
get GP somewhere inside UEFI)
- Lenovo B5400
- ASRock B450M Pro4
- Lenovo Ideapad Creator 5 -- does not work at all
- HP Pro x2 612 G2 -- does not work at all
The problem with last two laptops is that there is no PC-AT serial port
available there which would throw at me nice GP complain and I would be
able to investigate like I did in case of D3641-S.
Cheers,
Karel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alignment-fixes.patch
Type: text/x-patch
Size: 1751 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230416/751b9cec/attachment.bin>
More information about the devel
mailing list