vmlemon / Orion

Next-generation, L4Ka::Pistachio-based operating system
7 stars 0 forks source link

Problems with R3 access, in userland, on POWER8 #26

Open vmlemon opened 5 years ago

vmlemon commented 5 years ago

Not sure if it's a regression, but trying to build libl4 on POWER8 bails out, with the following, after playing with how we consume/serve R3, in L4_SystemClock():

[root@fedora28 user]# make
make[1]: Entering directory '/root/Orion/user/lib'
make[2]: Entering directory '/root/Orion/user/lib/l4'
===> debug.cc
gcc -x c++ -I../../include -I../.. -I/usr/lib/gcc/ppc64-redhat-linux/8/include   -nostdinc -g -O2 -msoft-float -mminimal-toc   -fno-stack-protector -lssp -O2 -g -Wall -Wshadow   -fno-stack-protector  -Wconversion -fno-exceptions -c debug.cc -o debug.o
In file included from ../../include/l4/kip.h:36,
                 from debug.cc:31:
../../include/l4/powerpc64/syscalls.h: In function ‘L4_Clock_t L4_SystemClock()’:
../../include/l4/powerpc64/syscalls.h:165:39: error: ‘dest’ was not declared in this scope
     register L4_Word_t r3 asm("r3") = dest.raw;
                                       ^~~~
../../include/l4/powerpc64/syscalls.h:172:12: error: request for member ‘raw’ in ‘r3’, which is of non-class type ‘L4_Word_t’ {aka ‘long unsigned int’}
   "=r" (r3.raw)
            ^~~
../../include/l4/powerpc64/syscalls.h:182:13: error: address of explicit register variable ‘r3’ requested
     return  r3 ;
             ^~
../../include/l4/powerpc64/syscalls.h:182:13: error: could not convert ‘r3’ from ‘L4_Word_t’ {aka ‘long unsigned int’} to ‘L4_Clock_t’
make[2]: *** [../../Mk/l4.build.mk:58: debug.o] Error 1
make[2]: Leaving directory '/root/Orion/user/lib/l4'
make[1]: *** [../Mk/l4.subdir.mk:41: subdirs-all] Error 2
make[1]: Leaving directory '/root/Orion/user/lib'
make: *** [Mk/l4.subdir.mk:41: subdirs-all] Error 2
[root@fedora28 user]# git pull --all
Fetching origin
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 7 (delta 6), reused 7 (delta 6), pack-reused 0
Unpacking objects: 100% (7/7), done.
From https://github.com/vmlemon/Orion
   cb0da7e..e3b6d6a  master     -> origin/master
Updating cb0da7e..e3b6d6a
Fast-forward
 user/include/l4/powerpc64/syscalls.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
[root@fedora28 user]# make
make[1]: Entering directory '/root/Orion/user/lib'
make[2]: Entering directory '/root/Orion/user/lib/l4'
===> debug.cc
gcc -x c++ -I../../include -I../.. -I/usr/lib/gcc/ppc64-redhat-linux/8/include   -nostdinc -g -O2 -msoft-float -mminimal-toc   -fno-stack-protector -lssp -O2 -g -Wall -Wshadow   -fno-stack-protector  -Wconversion -fno-exceptions -c debug.cc -o debug.o
In file included from ../../include/l4/kip.h:36,
                 from debug.cc:31:
../../include/l4/powerpc64/syscalls.h: In function ‘L4_Clock_t L4_SystemClock()’:
../../include/l4/powerpc64/syscalls.h:172:12: error: request for member ‘raw’ in ‘r3’, which is of non-class type ‘L4_Word_t’ {aka ‘long unsigned int’}
   "=r" (r3.raw)
            ^~~
../../include/l4/powerpc64/syscalls.h:182:13: error: address of explicit register variable ‘r3’ requested
     return  r3 ;
             ^~
../../include/l4/powerpc64/syscalls.h:182:13: error: could not convert ‘r3’ from ‘L4_Word_t’ {aka ‘long unsigned int’} to ‘L4_Clock_t’
make[2]: *** [../../Mk/l4.build.mk:58: debug.o] Error 1
make[2]: Leaving directory '/root/Orion/user/lib/l4'
make[1]: *** [../Mk/l4.subdir.mk:41: subdirs-all] Error 2
make[1]: Leaving directory '/root/Orion/user/lib'
make: *** [Mk/l4.subdir.mk:41: subdirs-all] Error 2
[root@fedora28 user]# 
vmlemon commented 5 years ago

Comparing the two versions of syscalls.h:

[fedora@fedora28 user]$ diff ../user.enryo/include/l4/powerpc64/syscalls.h  include/l4/powerpc64/syscalls.h 
158a159
> //../../include/l4/powerpc64/syscalls.h:180:17: error: address of explicit register variable ‘r3’ requested
164c165,166
<     register L4_Clock_t r3 asm("r3");
---
>     register L4_Word_t r3 asm("r3");// = dest.raw;
>     //register L4_Clock_t r3 asm("r3");
178c180,182
<     return ( r3 );
---
> //    L4_Clock_t rclock = r3;
> //return rclock;
>     return  r3 ;
vmlemon commented 5 years ago

Maybe, a bug in GCC? (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67064)