diff options
author | Gentoo <installgentoo@endianness.com> | 2021-03-27 10:36:05 +1100 |
---|---|---|
committer | Gentoo <installgentoo@endianness.com> | 2021-03-27 10:36:05 +1100 |
commit | 0349c6d6572f59770898d3f40287ebdcd2f8ed30 (patch) | |
tree | 4f55d594e5343a7d4f4e6d4dea34d9c35caa0b99 /source/sync.c | |
download | YetAnotherModLoader-0349c6d6572f59770898d3f40287ebdcd2f8ed30.tar.gz YetAnotherModLoader-0349c6d6572f59770898d3f40287ebdcd2f8ed30.tar.bz2 YetAnotherModLoader-0349c6d6572f59770898d3f40287ebdcd2f8ed30.zip |
Diffstat (limited to 'source/sync.c')
-rw-r--r-- | source/sync.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/sync.c b/source/sync.c new file mode 100644 index 0000000..f22827e --- /dev/null +++ b/source/sync.c @@ -0,0 +1,18 @@ +#include <stdint.h> + +//Originally written by Segher, but I changed the function enough to be "mine" +void sync_before_exec(const void *p, uint32_t len) +{ + uint32_t x, y; + + x = (uint32_t)p & ~0x1f; + y = ((uint32_t)p + len + 0x1f) & ~0x1f; + + while(x < y) + { + asm("dcbst 0,%0 ; sync ; icbi 0,%0" : : "b"(x)); + x += 32; + } + + asm("sync ; isync"); +} |