mirror of
https://github.com/elliotnunn/powermac-rom.git
synced 2024-07-30 10:28:54 +00:00
int handlers
This commit is contained in:
parent
4d3f6fe0b2
commit
f92444728f
@ -566,7 +566,7 @@ PA_ECB ds.l 1 ; 658 ; gets called "system context"
|
|||||||
PA_ContextBlock ds.l 1 ; 65c ; moved to EWA (per-CPU) in NKv2
|
PA_ContextBlock ds.l 1 ; 65c ; moved to EWA (per-CPU) in NKv2
|
||||||
Flags ds.l 1 ; 660 ; moved to EWA (per-CPU) in NKv2
|
Flags ds.l 1 ; 660 ; moved to EWA (per-CPU) in NKv2
|
||||||
Enables ds.l 1 ; 664 ; moved to EWA (per-CPU) in NKv2
|
Enables ds.l 1 ; 664 ; moved to EWA (per-CPU) in NKv2
|
||||||
ContextClock ds.l 1 ; 668
|
OtherContextDEC ds.l 1 ; 668 ; ticks the *inactive* context has left out of 1s
|
||||||
PA_PageMapEnd ds.l 1 ; 66c ; Set at the same time as PA_PageMapStart below...
|
PA_PageMapEnd ds.l 1 ; 66c ; Set at the same time as PA_PageMapStart below...
|
||||||
TestIntMaskInit ds.l 1 ; 670 ; These are all copied from ConfigInfo...
|
TestIntMaskInit ds.l 1 ; 670 ; These are all copied from ConfigInfo...
|
||||||
PostIntMaskInit ds.l 1 ; 674
|
PostIntMaskInit ds.l 1 ; 674
|
||||||
|
@ -307,10 +307,10 @@ SwitchContext ; OldCB *r6, NewCB *r9
|
|||||||
stw r31, 0x01fc(r6)
|
stw r31, 0x01fc(r6)
|
||||||
bnel DisableFPU
|
bnel DisableFPU
|
||||||
|
|
||||||
lwz r8, KDP.ContextClock(r1)
|
lwz r8, KDP.OtherContextDEC(r1)
|
||||||
mfdec r31
|
mfdec r31
|
||||||
cmpwi r8, 0
|
cmpwi r8, 0
|
||||||
stw r31, KDP.ContextClock(r1)
|
stw r31, KDP.OtherContextDEC(r1)
|
||||||
mtdec r8
|
mtdec r8
|
||||||
blel ResetDEC ; to r8
|
blel ResetDEC ; to r8
|
||||||
|
|
||||||
|
@ -2,76 +2,64 @@
|
|||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
_alignToCacheBlock
|
; Increment the Sys/Alt CPU clocks, and the Dec-int counter
|
||||||
|
_align 6
|
||||||
IntDecrementerSystem
|
IntDecrementerSystem
|
||||||
mfsprg r1, 0
|
mfsprg r1, 0
|
||||||
stmw r2, EWA.r2
|
stmw r2, EWA.r2(r1)
|
||||||
mfdec r31
|
mfdec r31
|
||||||
lwz r30, KDP.ContextBlock(r1)
|
lwz r30, KDP.OtherContextDEC(r1)
|
||||||
|
|
||||||
DecCommon
|
DecCommon ; DEC for Alternate=r30, System=r31
|
||||||
mfxer r29
|
mfxer r29 ; we will do carries
|
||||||
lwz r28, KDP.ProcessorInfo
|
|
||||||
|
lwz r28, KDP.ProcInfo.DecClockRateHz(r1)
|
||||||
|
stw r28, KDP.OtherContextDEC(r1)
|
||||||
|
mtdec r28 ; reset Sys and Alt decrementers
|
||||||
|
|
||||||
|
subf r31, r31, r28 ; System ticks actually elapsed
|
||||||
|
subf r30, r30, r28 ; Alternate ticks actually elapsed
|
||||||
|
|
||||||
|
lwz r28, KDP.NKInfo.SysContextCpuTime+4(r1)
|
||||||
|
lwz r27, KDP.NKInfo.SysContextCpuTime(r1)
|
||||||
|
addc r28, r28, r31
|
||||||
|
addze r27, r27
|
||||||
|
stw r28, KDP.NKInfo.SysContextCpuTime+4(r1)
|
||||||
|
stw r27, KDP.NKInfo.SysContextCpuTime(r1)
|
||||||
|
|
||||||
|
lwz r28, KDP.NKInfo.AltContextCpuTime+4(r1)
|
||||||
|
lwz r27, KDP.NKInfo.AltContextCpuTime(r1)
|
||||||
|
addc r28, r28, r30
|
||||||
|
addze r27, r27
|
||||||
|
stw r28, KDP.NKInfo.AltContextCpuTime+4(r1)
|
||||||
|
stw r27, KDP.NKInfo.AltContextCpuTime(r1)
|
||||||
|
|
||||||
|
mtxer r29
|
||||||
|
|
||||||
|
stw r0, EWA.r0(r1)
|
||||||
|
mfsprg r31, 1
|
||||||
|
stw r31, EWA.r1(r1)
|
||||||
|
|
||||||
|
lwz r31, KDP.NKInfo.DecrementerIntCount(r1)
|
||||||
|
addi r31, r31, 1
|
||||||
|
stw r31, KDP.NKInfo.DecrementerIntCount(r1)
|
||||||
|
|
||||||
|
lmw r27, EWA.r27(r1)
|
||||||
|
mfsprg r1, 2
|
||||||
|
mtlr r1
|
||||||
|
mfsprg r1, 1
|
||||||
|
rfi
|
||||||
|
|
||||||
IntDecrementerAlternate
|
IntDecrementerAlternate
|
||||||
mfsprg r1, 0
|
mfsprg r1, 0
|
||||||
stmw r2, EWA.r2
|
stmw r2, EWA.r2(r1)
|
||||||
lwz r31, KDP.ContextBlock(r1)
|
lwz r31, KDP.OtherContextDEC(r1)
|
||||||
mfdec r30
|
mfdec r30
|
||||||
b DecCommon
|
b DecCommon
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IntDecrementer
|
|
||||||
bl LoadInterruptRegisters
|
|
||||||
|
|
||||||
lwz r8, KDP.OldKDP(r1)
|
|
||||||
rlwinm. r9, r11, 0, 16, 16
|
|
||||||
cmpwi cr1, r8, 0x00
|
|
||||||
beq MaskedInterruptTaken
|
|
||||||
beq cr1, IntDecrementer_0x54
|
|
||||||
|
|
||||||
stw r16, ContextBlock.r16(r6)
|
|
||||||
stw r17, ContextBlock.r17(r6)
|
|
||||||
stw r18, ContextBlock.r18(r6)
|
|
||||||
stw r25, ContextBlock.r25(r6)
|
|
||||||
|
|
||||||
bl SchFiddlePriorityShifty
|
|
||||||
ble IntDecrementer_0x48
|
|
||||||
|
|
||||||
lwz r8, PSA.CriticalReadyQ + ReadyQueue.Timecake + 4(r1)
|
|
||||||
mtspr dec, r8
|
|
||||||
|
|
||||||
lwz r16, ContextBlock.r16(r6)
|
|
||||||
lwz r17, ContextBlock.r17(r6)
|
|
||||||
lwz r18, ContextBlock.r18(r6)
|
|
||||||
b IntReturn
|
|
||||||
|
|
||||||
IntDecrementer_0x48
|
|
||||||
lwz r16, 0x0184(r6)
|
|
||||||
lwz r17, 0x018c(r6)
|
|
||||||
lwz r18, 0x0194(r6)
|
|
||||||
|
|
||||||
IntDecrementer_0x54
|
|
||||||
; r6 = ewa
|
|
||||||
bl SchSaveStartingAtR14
|
|
||||||
; r8 = sprg0 (not used by me)
|
|
||||||
|
|
||||||
|
|
||||||
_Lock PSA.SchLock, scratch1=r8, scratch2=r9
|
|
||||||
|
|
||||||
lwz r8, 0x0e8c(r1)
|
|
||||||
addi r8, r8, 0x01
|
|
||||||
stw r8, 0x0e8c(r1)
|
|
||||||
bl TimerDispatch
|
|
||||||
_AssertAndRelease PSA.SchLock, scratch=r8
|
|
||||||
|
|
||||||
bl SchRestoreStartingAtR14
|
|
||||||
b IntReturn
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
_alignToCacheBlock
|
_align 6
|
||||||
IntDSI
|
IntDSI
|
||||||
mfsprg r1, 0
|
mfsprg r1, 0
|
||||||
stmw r2, EWA.r2(r1)
|
stmw r2, EWA.r2(r1)
|
||||||
@ -98,7 +86,8 @@ EmulateDataAccess
|
|||||||
lwzx r18, r1, r18
|
lwzx r18, r1, r18
|
||||||
@r0
|
@r0
|
||||||
andis. r26, r27, 0xec00
|
andis. r26, r27, 0xec00
|
||||||
lwz r16, EWA.Flags(r1)
|
lwz r16, KDP.Flags(r1)
|
||||||
|
mfsprg r24, 3
|
||||||
rlwinm r17, r27, 0, 6, 15
|
rlwinm r17, r27, 0, 6, 15
|
||||||
rlwimi r16, r16, 27, 26, 26
|
rlwimi r16, r16, 27, 26, 26
|
||||||
bge @low_opcode
|
bge @low_opcode
|
||||||
@ -133,7 +122,7 @@ EmulateDataAccess
|
|||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
_alignToCacheBlock
|
_align 6
|
||||||
IntAlignment
|
IntAlignment
|
||||||
mfsprg r1, 0
|
mfsprg r1, 0
|
||||||
stmw r2, EWA.r2(r1)
|
stmw r2, EWA.r2(r1)
|
||||||
@ -188,10 +177,15 @@ IntAlignment
|
|||||||
blr
|
blr
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
; FDP GOES HERE!
|
|
||||||
|
; FDP GOES HERE (0xC00)! (just include it as a file?)
|
||||||
|
; there are some big mistakes in the labels below!
|
||||||
|
_align 10
|
||||||
|
FDP
|
||||||
|
dcb.l (0x1874-0xC00)/4, 0x46445020 ; 'FDP '
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
_alignToCacheBlock
|
|
||||||
IntISI
|
IntISI
|
||||||
bl LoadInterruptRegisters
|
bl LoadInterruptRegisters
|
||||||
|
|
||||||
|
@ -321,3 +321,17 @@ _bclr_lbit set 31
|
|||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
|
||||||
|
MACRO
|
||||||
|
_align &arg
|
||||||
|
|
||||||
|
my_align set 1 << (&arg)
|
||||||
|
my_mask set my_align - 1
|
||||||
|
my_offset set * - NKTop
|
||||||
|
my_pad set (my_align - (my_offset & my_mask)) & my_mask
|
||||||
|
IF my_pad
|
||||||
|
dcb.l my_pad>>2, 0x48000004
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
ENDM
|
||||||
|
@ -9,6 +9,16 @@
|
|||||||
include 'NKEquates.s'
|
include 'NKEquates.s'
|
||||||
include 'NKMacros.s'
|
include 'NKMacros.s'
|
||||||
|
|
||||||
|
; I want these to be visibly wrong for the time being
|
||||||
|
FDP_TableBase
|
||||||
|
FDP_003C
|
||||||
|
loc_A38
|
||||||
|
FDP_011C
|
||||||
|
loc_D50
|
||||||
|
FDP_0DA0
|
||||||
|
MemRetryDSI
|
||||||
|
MemRetryMachineCheck
|
||||||
|
|
||||||
NKTop
|
NKTop
|
||||||
b VMPanic
|
b VMPanic
|
||||||
|
|
||||||
@ -37,40 +47,8 @@ IntForEmulator_2
|
|||||||
org 0x840
|
org 0x840
|
||||||
IntForEmulator_3
|
IntForEmulator_3
|
||||||
org 0x940
|
org 0x940
|
||||||
IntDecrementerSystem
|
|
||||||
org 0x9C8
|
|
||||||
IntDecrementerAlternate
|
|
||||||
org 0xA00
|
|
||||||
IntDSI
|
|
||||||
org 0xB00
|
|
||||||
IntAlignment
|
|
||||||
|
|
||||||
org 0xC00
|
|
||||||
FDP
|
|
||||||
org 0xC38
|
|
||||||
FDP_003C
|
|
||||||
org 0xA38
|
|
||||||
loc_A38
|
|
||||||
org 0xD18
|
|
||||||
FDP_011C
|
|
||||||
org 0xD50
|
|
||||||
loc_D50
|
|
||||||
FDP_0DA0
|
|
||||||
|
|
||||||
org 0x13F4
|
|
||||||
MemRetryDSI
|
|
||||||
org 0x1498
|
|
||||||
MemRetryMachineCheck
|
|
||||||
org 0x1874
|
|
||||||
IntISI
|
|
||||||
org 0x18C4
|
|
||||||
major_0x039dc
|
|
||||||
org 0x18D8
|
|
||||||
major_0x039dc_0x14
|
|
||||||
org 0x18EC
|
|
||||||
IntMachineCheck
|
|
||||||
org 0x18F8
|
|
||||||
|
|
||||||
|
include 'NKIntHandlers.s'
|
||||||
include 'NKMemory.s'
|
include 'NKMemory.s'
|
||||||
include 'NKExceptions.s'
|
include 'NKExceptions.s'
|
||||||
include 'NKFloatingPt.s'
|
include 'NKFloatingPt.s'
|
||||||
|
Loading…
Reference in New Issue
Block a user