mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-19 19:30:42 +00:00
Don't fake the TVECT value on non-BeOS native systems. This is important
for systems that use a global r2 as the TLS register, e.g. Linux/ppc with newer glibc. Also remove the syscall junk which were simply workarounds for this bug. Remove a duplicate r2 restoration in EmulOp. BTW, it's possible to get SheepShaver running on Linux/ppc systems with NPTL rather than SheepThreads.
This commit is contained in:
parent
b9b90fce11
commit
26ee263b6f
@ -286,8 +286,8 @@ static inline int sig_stack_release(void)
|
||||
|
||||
// Global variables (exported)
|
||||
#if !EMULATED_PPC
|
||||
void *TOC; // Pointer to Thread Local Storage (r2)
|
||||
void *R13; // Pointer to .sdata section (r13 under Linux)
|
||||
void *TOC = NULL; // Pointer to Thread Local Storage (r2)
|
||||
void *R13 = NULL; // Pointer to .sdata section (r13 under Linux)
|
||||
#endif
|
||||
uint32 RAMBase; // Base address of Mac RAM
|
||||
uint32 RAMSize; // Size of Mac RAM
|
||||
|
@ -381,7 +381,6 @@ C_SYMBOL_NAME(jump_to_rom):
|
||||
stw r0,16(r1)
|
||||
stw r2,12(r1)
|
||||
stwu r1,-(24+16*4+15*8)(r1)
|
||||
RESTORE_SYSTEM_R2
|
||||
|
||||
// Save 68k registers (M68kRegisters)
|
||||
stw r8,24+0*4(r1) // d[0]..d[7]
|
||||
@ -916,57 +915,3 @@ C_SYMBOL_NAME(ppc_interrupt):
|
||||
// Enter nanokernel
|
||||
mtlr r3
|
||||
blr
|
||||
|
||||
|
||||
/*
|
||||
* Glue for glibc with TLS support which clobbers r2
|
||||
*
|
||||
* The following is derived from dietlibc and only provides
|
||||
* pass-through to kernel syscalls. You also lose asynchronous
|
||||
* cancellation support.
|
||||
*/
|
||||
|
||||
#if defined(__linux__)
|
||||
#define __NR_getpid 20
|
||||
#define __NR__newselect 142
|
||||
|
||||
#define syscall_weak(name,wsym,sym) \
|
||||
.text; \
|
||||
.type wsym,@function; \
|
||||
.weak wsym; \
|
||||
wsym: ; \
|
||||
.type sym,@function; \
|
||||
.global sym; \
|
||||
sym: \
|
||||
li 0,__NR_##name; \
|
||||
b __unified_syscall
|
||||
|
||||
#define syscall(name,sym) \
|
||||
.text; \
|
||||
.type sym,@function; \
|
||||
.global sym; \
|
||||
sym: \
|
||||
li 0,__NR_##name; \
|
||||
b __unified_syscall
|
||||
|
||||
|
||||
.type __unified_syscall,@function
|
||||
__unified_syscall:
|
||||
sc
|
||||
bnslr+
|
||||
stwu 1,-16(1)
|
||||
mflr 0
|
||||
stw 0,20(1)
|
||||
stw 3,12(1)
|
||||
bl __errno_location
|
||||
lwz 0,12(1)
|
||||
stw 0,0(3)
|
||||
lwz 0,20(1)
|
||||
mtlr 0
|
||||
addi 1,1,16
|
||||
blr
|
||||
|
||||
/* name weak symbol symbol */
|
||||
syscall( getpid, getpid)
|
||||
syscall_weak( _newselect, select, __select)
|
||||
#endif
|
||||
|
@ -219,7 +219,7 @@ bool ThunksInit(void)
|
||||
#define DEFINE_NATIVE_OP(ID, FUNC) do { \
|
||||
uintptr base = SheepMem::Reserve(8); \
|
||||
WriteMacInt32(base + 0, (uint32)FUNC); \
|
||||
WriteMacInt32(base + 4, 0); /*Fake TVECT*/ \
|
||||
WriteMacInt32(base + 4, (uint32)TOC); \
|
||||
native_op[ID].tvect = base; \
|
||||
native_op[ID].func = (uint32)FUNC; \
|
||||
} while (0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user