Initial commit
This commit is contained in:
40
wiipax/stub/sync.c
Normal file
40
wiipax/stub/sync.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "common.h"
|
||||
|
||||
void sync_before_read(void *p, u32 len)
|
||||
{
|
||||
u32 a, b;
|
||||
|
||||
a = (u32)p & ~0x1f;
|
||||
b = ((u32)p + len + 0x1f) & ~0x1f;
|
||||
|
||||
for ( ; a < b; a += 32)
|
||||
asm("dcbi 0,%0" : : "b"(a));
|
||||
|
||||
asm("sync ; isync");
|
||||
}
|
||||
|
||||
void sync_after_write(const void *p, u32 len)
|
||||
{
|
||||
u32 a, b;
|
||||
|
||||
a = (u32)p & ~0x1f;
|
||||
b = ((u32)p + len + 0x1f) & ~0x1f;
|
||||
|
||||
for ( ; a < b; a += 32)
|
||||
asm("dcbst 0,%0" : : "b"(a));
|
||||
|
||||
asm("sync ; isync");
|
||||
}
|
||||
|
||||
void sync_before_exec(const void *p, u32 len)
|
||||
{
|
||||
u32 a, b;
|
||||
|
||||
a = (u32)p & ~0x1f;
|
||||
b = ((u32)p + len + 0x1f) & ~0x1f;
|
||||
|
||||
for ( ; a < b; a += 32)
|
||||
asm("dcbst 0,%0 ; sync ; icbi 0,%0" : : "b"(a));
|
||||
|
||||
asm("sync ; isync");
|
||||
}
|
||||
Reference in New Issue
Block a user