From 71c936c3021954832d5e6a0864c8c57db559b412 Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Sun, 8 Jul 2018 18:05:24 +0800 Subject: [PATCH] fix aligns now they are byte-perfect... but customized... --- NanoKernel/NKExceptions.s | 2 +- NanoKernel/NKFloatingPt.s | 2 +- NanoKernel/NKIntHandlers.s | 14 +++++++------- NanoKernel/NKMacros.s | 11 +++++++++++ NanoKernel/NKPowerCalls.s | 4 ++-- NanoKernel/NKSoftInt.s | 12 ++++++------ 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/NanoKernel/NKExceptions.s b/NanoKernel/NKExceptions.s index 3742f64..5bbff4e 100644 --- a/NanoKernel/NKExceptions.s +++ b/NanoKernel/NKExceptions.s @@ -98,7 +98,7 @@ PreferRegistersFromKDPSavingContextBlock ######################################################################## - align kIntAlign + _alignToCacheBlock KCallReturnFromExceptionFastPath lwz r11, KDP.NanoKernelInfo + NKNanoKernelInfo.NanoKernelCallCounts(r1) mr r10, r12 diff --git a/NanoKernel/NKFloatingPt.s b/NanoKernel/NKFloatingPt.s index ab30552..02e5ae5 100644 --- a/NanoKernel/NKFloatingPt.s +++ b/NanoKernel/NKFloatingPt.s @@ -2,7 +2,7 @@ ######################################################################## - align kIntAlign + _alignToCacheBlock IntFPUnavail ; Reload the FPU diff --git a/NanoKernel/NKIntHandlers.s b/NanoKernel/NKIntHandlers.s index 04e0eb5..971431d 100644 --- a/NanoKernel/NKIntHandlers.s +++ b/NanoKernel/NKIntHandlers.s @@ -46,7 +46,7 @@ - align kIntAlign + _alignToCacheBlock IntDecrementer ; OUTSIDE REFERER @@ -108,7 +108,7 @@ IntDecrementer_0x54 ; Kick it to the FDP-associated MemRetryDSI - align kIntAlign + _alignToCacheBlock IntDSI @@ -250,7 +250,7 @@ major_0x03324_0x12c ; This int handler is our best foothold into the FDP! - align kIntAlign + _alignToCacheBlock IntAlignment ; OUTSIDE REFERER mfsprg r1, 0 @@ -372,7 +372,7 @@ major_0x03548_0x20 ; OUTSIDE REFERER - align kIntAlign + _alignToCacheBlock MemRetryDSI ; OUTSIDE REFERER @@ -591,7 +591,7 @@ MemRetryMachineCheck_0x14c ; OUTSIDE REFERER - align kIntAlign + _alignToCacheBlock IntISI ; OUTSIDE REFERER @@ -696,7 +696,7 @@ MaskedInterruptTaken ; OUTSIDE REFERER - align kIntAlign + _alignToCacheBlock PIHDSI ; OUTSIDE REFERER mfspr r8, dsisr @@ -731,7 +731,7 @@ PIHDSI ; OUTSIDE REFERER # # # # # # # # # # # # # ## # # # # # # # # # # # # # # # # # # # ## # # #### # # ###### # #### # # # # # # # #### # # ####### # # #### ###### # # # #### # # - align kIntAlign + _alignToCacheBlock ; dead code? diff --git a/NanoKernel/NKMacros.s b/NanoKernel/NKMacros.s index 8999060..f686370 100644 --- a/NanoKernel/NKMacros.s +++ b/NanoKernel/NKMacros.s @@ -310,3 +310,14 @@ _bclr_lbit set 31 addi &rd, &rs, (&label-NKTop) ENDM + + + MACRO + _alignToCacheBlock + + IF (*-NKTop) & 0x1f + b * + 4 + _alignToCacheBlock + ENDIF + + ENDM diff --git a/NanoKernel/NKPowerCalls.s b/NanoKernel/NKPowerCalls.s index a2dc64e..fd420ed 100644 --- a/NanoKernel/NKPowerCalls.s +++ b/NanoKernel/NKPowerCalls.s @@ -26,7 +26,7 @@ ; three interrupts will return the CPU to full-on mode, and we will return ; from the PowerDispatch call. Called at NK init time. - align kIntAlign + _alignToCacheBlock InitIdleVecTable @@ -57,7 +57,7 @@ InitIdleVecTable ; ARG selector r3 (0-11), ... - align kIntAlign + _alignToCacheBlock kcPowerDispatch diff --git a/NanoKernel/NKSoftInt.s b/NanoKernel/NKSoftInt.s index 4fe7cb0..97903ea 100644 --- a/NanoKernel/NKSoftInt.s +++ b/NanoKernel/NKSoftInt.s @@ -94,7 +94,7 @@ IllegalInstruction ######################################################################## - align kIntAlign + _alignToCacheBlock KCallRunAlternateContext ; ARG ContextBlock *r3, flags r4 @@ -240,7 +240,7 @@ KCallRunAlternateContext ######################################################################## - align kIntAlign + _alignToCacheBlock KCallResetSystem ; PPC trap 1, or indirectly, 68k RESET @@ -267,7 +267,7 @@ Reset ######################################################################## - align kIntAlign + _alignToCacheBlock KCallPrioritizeInterrupts ; Left side: roll back the interrupt preparation before the int handler repeats is ; Right side: jump to the external interrupt handler (PIH or IntProgram) @@ -324,7 +324,7 @@ KCallSystemCrash ######################################################################## - align kIntAlign + _alignToCacheBlock IntProgram ; (also called when the Alternate Context gets an External Int => Exception) @@ -423,7 +423,7 @@ IntProgram ######################################################################## - align kIntAlign + _alignToCacheBlock IntSyscall bl LoadInterruptRegisters @@ -435,7 +435,7 @@ IntSyscall ######################################################################## - align kIntAlign + _alignToCacheBlock IntTrace bl LoadInterruptRegisters