-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathOSSync.c
55 lines (48 loc) · 1.14 KB
/
OSSync.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <platform.h>
#include <placeholder.h>
#include <__mem.h>
#include <dolphin/os/OSCache.h>
#include <dolphin/os/OSSync.h>
#include <MetroTRK/intrinsics.h>
#define OS_SYS_CALL_HANDLER ((void*) 0x80000C00)
#define OS_HANDLER_SLOT_SIZE (0x100)
static void __OSSystemCallVectorStart(void);
static void __OSSystemCallVectorEnd(void);
#ifdef MWERKS_GEKKO
asm void __OSSystemCallVector(void)
{ // clang-format off
nofralloc
entry __OSSystemCallVectorStart
mfspr r9, DBSR
ori r10, r9, 8
mtspr DBSR, r10
isync
sync
mtspr DBSR, r9
rfi
entry __OSSystemCallVectorEnd
nop
} // clang-format on
#else
void __OSSystemCallVector(void)
{
NOT_IMPLEMENTED;
}
#endif
#ifdef MWERKS_GEKKO
/// @attention <tt>peephole off</tt> is needed to match.
void __OSInitSystemCall(void)
{
void* handler = OS_SYS_CALL_HANDLER;
memcpy(handler, __OSSystemCallVectorStart,
(u32) __OSSystemCallVectorEnd - (u32) __OSSystemCallVectorStart);
DCFlushRangeNoSync(handler, OS_HANDLER_SLOT_SIZE);
__sync();
ICInvalidateRange(handler, OS_HANDLER_SLOT_SIZE);
}
#else
void __OSInitSystemCall(void)
{
NOT_IMPLEMENTED;
}
#endif