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
diff --git a/cpukit/rtems/src/taskconstruct.c b/cpukit/rtems/src/taskconstruct.c
index 531d64903d..d88bdb539c 100644
--- a/cpukit/rtems/src/taskconstruct.c
+++ b/cpukit/rtems/src/taskconstruct.c
@@ -136,7 +136,7 @@ rtems_status_code _RTEMS_tasks_Create(
 )
 {
   Thread_Control          *the_thread;
-  Thread_Configuration     thread_config;
+  Thread_Configuration     thread_config RTEMS_ALIGNED(32);
 #if defined(RTEMS_MULTIPROCESSING)
   Objects_MP_Control      *the_global_object = NULL;
   bool                     is_global;
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index 4f16a57099..023e612022 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -58,7 +58,7 @@ static void _Thread_Create_idle_for_CPU(
   uintptr_t        storage_size
 )
 {
-  Thread_Configuration  config;
+  Thread_Configuration  config RTEMS_ALIGNED(32);
   Thread_Control       *idle;
   Status_Control        status;
 
diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c
index ae3719c2cd..5bc5deeab0 100644
--- a/testsuites/libtests/malloctest/init.c
+++ b/testsuites/libtests/malloctest/init.c
@@ -1419,7 +1419,7 @@ rtems_task Init(
 )
 {
   void             *p1;
-  rtems_time_of_day time;
+  rtems_time_of_day time RTEMS_ALIGNED(32);
   rtems_status_code status;
 
   TEST_BEGIN();
diff --git a/testsuites/samples/ticker/init.c b/testsuites/samples/ticker/init.c
index 86f87ad736..2f2929376f 100644
--- a/testsuites/samples/ticker/init.c
+++ b/testsuites/samples/ticker/init.c
@@ -47,7 +47,7 @@ rtems_task Init(
 )
 {
   rtems_status_code status;
-  rtems_time_of_day time;
+  rtems_time_of_day time RTEMS_ALIGNED(32);
 
   TEST_BEGIN();
 
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to