diff options
Diffstat (limited to 'src/buildvm_ppc.dasc')
-rw-r--r-- | src/buildvm_ppc.dasc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index 132242d8..027e75b0 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
@@ -2533,6 +2533,31 @@ static void build_subroutines(BuildCtx *ctx) | |||
2533 | |//-- Miscellaneous functions -------------------------------------------- | 2533 | |//-- Miscellaneous functions -------------------------------------------- |
2534 | |//----------------------------------------------------------------------- | 2534 | |//----------------------------------------------------------------------- |
2535 | | | 2535 | | |
2536 | |// void lj_vm_cachesync(void *start, void *end) | ||
2537 | |// Flush D-Cache and invalidate I-Cache. Assumes 32 byte cache line size. | ||
2538 | |// This is a good lower bound, except for very ancient PPC models. | ||
2539 | |->vm_cachesync: | ||
2540 | | // Compute start of first cache line and number of cache lines. | ||
2541 | | rlwinm CARG1, CARG1, 0, 0, 26 | ||
2542 | | sub CARG2, CARG2, CARG1 | ||
2543 | | addi CARG2, CARG2, 31 | ||
2544 | | rlwinm. CARG2, CARG2, 27, 5, 31 | ||
2545 | | beqlr | ||
2546 | | mtctr CARG2 | ||
2547 | | mr CARG3, CARG1 | ||
2548 | |1: // Flush D-Cache. | ||
2549 | | dcbst r0, CARG1 | ||
2550 | | addi CARG1, CARG1, 32 | ||
2551 | | bdnz <1 | ||
2552 | | sync | ||
2553 | | mtctr CARG2 | ||
2554 | |1: // Invalidate I-Cache. | ||
2555 | | icbi r0, CARG3 | ||
2556 | | addi CARG3, CARG3, 32 | ||
2557 | | bdnz <1 | ||
2558 | | isync | ||
2559 | | blr | ||
2560 | | | ||
2536 | |//----------------------------------------------------------------------- | 2561 | |//----------------------------------------------------------------------- |
2537 | |//-- FFI helper functions ----------------------------------------------- | 2562 | |//-- FFI helper functions ----------------------------------------------- |
2538 | |//----------------------------------------------------------------------- | 2563 | |//----------------------------------------------------------------------- |