PATCH: PowerPC ABI change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

While the PPC Win32 ABI uses r13 as TLS register, the SysVr4 PPC32
ELF ABI uses r13 as pointer to the datasection when compiling in
the small data modell.

Using a dissambler I found just one use of r13, when it is being
loaded in _start of the WINE binary.

Unfortunately we have loaded it before _start is called.

For now I am changing it to another register, r2, which is also
unused by the normal ABI. Later glibc versions will use this as
their TLS register though.

So win32 .exe files will not run. But our compiled source will.
A hack could be added later.

Ciao, Marcus

License: LGPL
Changelog:
	Use r2 instead of r13 for TLS, since r13 is used in
	the ELF32 PPC ABI.


Index: include/winnt.h
===================================================================
RCS file: /home/wine/wine/include/winnt.h,v
retrieving revision 1.117
diff -u -r1.117 winnt.h
--- include/winnt.h	15 Aug 2002 21:57:36 -0000	1.117
+++ include/winnt.h	19 Aug 2002 10:07:24 -0000
@@ -2332,7 +2332,7 @@
 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
 {
     struct _TEB *teb;
-    __asm__("\tmr %0, 13" : "=r" (teb));
+    __asm__("\tmr %0, 2" : "=r" (teb));
     return teb;
 }
 #else
Index: scheduler/sysdeps.c
===================================================================
RCS file: /home/wine/wine/scheduler/sysdeps.c,v
retrieving revision 1.47
diff -u -r1.47 sysdeps.c
--- scheduler/sysdeps.c	17 Aug 2002 00:43:20 -0000	1.47
+++ scheduler/sysdeps.c	19 Aug 2002 10:07:42 -0000
@@ -91,7 +91,7 @@
     wine_set_fs( teb->teb_sel );
 #elif defined(__powerpc__)
     /* On PowerPC, the current TEB is in the gpr13 register */
-    __asm__ __volatile__("mr 13, %0" : : "r" (teb));
+    __asm__ __volatile__("mr 2, %0" : : "r" (teb));
 #elif defined(HAVE__LWP_CREATE)
     /* On non-i386 Solaris, we use the LWP private pointer */
     _lwp_setprivate( teb );
@@ -343,7 +343,7 @@
     return (struct _TEB *)_lwp_getprivate();
 }
 #elif defined(__powerpc__)
-__ASM_GLOBAL_FUNC( NtCurrentTeb, "\n\tmr 3,13\n\tblr" );
+__ASM_GLOBAL_FUNC( NtCurrentTeb, "\n\tmr 3,2\n\tblr" );
 #else
 # error NtCurrentTeb not defined for this architecture
 #endif  /* __i386__ */


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux