mirror of
https://github.com/FIX94/hbc.git
synced 2024-11-01 00:25:09 +01:00
41 lines
635 B
C
41 lines
635 B
C
#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");
|
|
}
|