MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / OSExceptionVector

Function OSExceptionVector

src/dolphin/src/os/OS.c:549–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

547}
548
549static asm void OSExceptionVector(void)
550{
551 /* clang-format off */
552 nofralloc
553
554entry __OSEVStart
555 // Save r4 into SPRG0
556 mtsprg 0, r4
557
558 // Load current context physical address into r4
559 lwz r4, OS_CURRENTCONTEXT_PADDR
560
561 // Save r3 - r5 into the current context
562 stw r3, OS_CONTEXT_R3(r4)
563 mfsprg r3, 0
564 stw r3, OS_CONTEXT_R4(r4)
565 stw r5, OS_CONTEXT_R5(r4)
566
567 lhz r3, OS_CONTEXT_STATE(r4)
568 ori r3, r3, OS_CONTEXT_STATE_EXC
569 sth r3, OS_CONTEXT_STATE(r4)
570
571 // Save misc registers
572 mfcr r3
573 stw r3, OS_CONTEXT_CR(r4)
574 mflr r3
575 stw r3, OS_CONTEXT_LR(r4)
576 mfctr r3
577 stw r3, OS_CONTEXT_CTR(r4)
578 mfxer r3
579 stw r3, OS_CONTEXT_XER(r4)
580 mfsrr0 r3
581 stw r3, OS_CONTEXT_SRR0(r4)
582 mfsrr1 r3
583 stw r3, OS_CONTEXT_SRR1(r4)
584 mr r5, r3
585
586entry __DBVECTOR
587 nop
588
589 // Set SRR1[IR|DR] to turn on address
590 // translation at the next RFI
591 mfmsr r3
592 ori r3, r3, 0x30
593 mtsrr1 r3
594
595 // This lets us change the exception number based on the
596 // exception we're installing.
597entry __OSEVSetNumber
598 addi r3, 0, 0x0000
599
600 // Load current context virtual address into r4
601 lwz r4, 0xD4
602
603 // Check non-recoverable interrupt
604 rlwinm. r5, r5, 0, MSR_RI_BIT, MSR_RI_BIT
605 bne recoverable
606 addis r5, 0, OSDefaultExceptionHandler@ha

Callers

nothing calls this directly

Calls 1

__OSUnhandledExceptionFunction · 0.85

Tested by

no test coverage detected