mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-23 04:33:24 +00:00
- enable multicore cpu emulation with ASYNC_IRQ
- move atomic_* operations to main_unix so that they could use spinlocks or other platform-specific locking mechanisms
This commit is contained in:
parent
7312739738
commit
d766049d59
@ -232,11 +232,7 @@ static void sigill_handler(int sig, sigcontext_struct *sc);
|
||||
|
||||
|
||||
// From asm_linux.S
|
||||
#if EMULATED_PPC
|
||||
extern int atomic_add(int *var, int v);
|
||||
extern int atomic_and(int *var, int v);
|
||||
extern int atomic_or(int *var, int v);
|
||||
#else
|
||||
#if !EMULATED_PPC
|
||||
extern "C" void *get_toc(void);
|
||||
extern "C" void *get_sp(void);
|
||||
extern "C" void flush_icache_range(void *start, void *end);
|
||||
@ -251,6 +247,47 @@ extern void paranoia_check(void);
|
||||
#endif
|
||||
|
||||
|
||||
#if EMULATED_PPC
|
||||
/*
|
||||
* Atomic operations
|
||||
*/
|
||||
|
||||
#if HAVE_SPINLOCKS
|
||||
static spinlock_t atomic_ops_lock = SPIN_LOCK_UNLOCKED;
|
||||
#else
|
||||
#define spin_lock(LOCK)
|
||||
#define spin_unlock(LOCK)
|
||||
#endif
|
||||
|
||||
int atomic_add(int *var, int v)
|
||||
{
|
||||
spin_lock(&atomic_ops_lock);
|
||||
int ret = *var;
|
||||
*var += v;
|
||||
spin_unlock(&atomic_ops_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int atomic_and(int *var, int v)
|
||||
{
|
||||
spin_lock(&atomic_ops_lock);
|
||||
int ret = *var;
|
||||
*var &= v;
|
||||
spin_unlock(&atomic_ops_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int atomic_or(int *var, int v)
|
||||
{
|
||||
spin_lock(&atomic_ops_lock);
|
||||
int ret = *var;
|
||||
*var |= v;
|
||||
spin_unlock(&atomic_ops_lock);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Main program
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ static void enter_mon(void)
|
||||
}
|
||||
|
||||
// Enable multicore (main/interrupts) cpu emulation?
|
||||
#define MULTICORE_CPU 0
|
||||
#define MULTICORE_CPU (ASYNC_IRQ ? 1 : 0)
|
||||
|
||||
// Enable Execute68k() safety checks?
|
||||
#define SAFE_EXEC_68K 1
|
||||
@ -604,11 +604,6 @@ void emul_ppc(uint32 entry)
|
||||
* Handle PowerPC interrupt
|
||||
*/
|
||||
|
||||
// Atomic operations
|
||||
extern int atomic_add(int *var, int v);
|
||||
extern int atomic_and(int *var, int v);
|
||||
extern int atomic_or(int *var, int v);
|
||||
|
||||
#if !ASYNC_IRQ
|
||||
void TriggerInterrupt(void)
|
||||
{
|
||||
@ -901,31 +896,6 @@ uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 a
|
||||
return current_cpu->execute_macos_code(tvect, sizeof(args)/sizeof(args[0]), args);
|
||||
}
|
||||
|
||||
/*
|
||||
* Atomic operations
|
||||
*/
|
||||
|
||||
int atomic_add(int *var, int v)
|
||||
{
|
||||
int ret = *var;
|
||||
*var += v;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int atomic_and(int *var, int v)
|
||||
{
|
||||
int ret = *var;
|
||||
*var &= v;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int atomic_or(int *var, int v)
|
||||
{
|
||||
int ret = *var;
|
||||
*var |= v;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Resource Manager thunks
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user