diff options
author | red031000 <rubenru09@aol.com> | 2020-05-24 18:12:56 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-05-24 18:12:56 +0100 |
commit | 0dfb0011dd9d7e485ecbc8727f71d2f82b946930 (patch) | |
tree | a0b28649e7d09fe25726e54e144ed9644c27efa7 | |
parent | 1856ec317f9952f1c379aa5c20488832e98417f0 (diff) |
OS_protectionUnit.c
-rw-r--r-- | arm9/asm/OS_protectionUnit.s | 18 | ||||
-rw-r--r-- | arm9/lib/include/OS_init.h | 1 | ||||
-rw-r--r-- | arm9/lib/include/OS_protectionUnit.h | 11 | ||||
-rw-r--r-- | arm9/lib/include/OS_reset.h | 6 | ||||
-rw-r--r-- | arm9/lib/src/OS_protectionUnit.c | 21 | ||||
-rw-r--r-- | arm9/lib/src/OS_reset.c | 6 |
6 files changed, 39 insertions, 24 deletions
diff --git a/arm9/asm/OS_protectionUnit.s b/arm9/asm/OS_protectionUnit.s deleted file mode 100644 index c26f86ba..00000000 --- a/arm9/asm/OS_protectionUnit.s +++ /dev/null @@ -1,18 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - arm_func_start OS_EnableProtectionUnit -OS_EnableProtectionUnit: ; 0x020CC9B8 - mrc p15, 0x0, r0, c1, c0, 0x0 - orr r0, r0, #0x1 - mcr p15, 0x0, r0, c1, c0, 0x0 - bx lr - - arm_func_start OS_DisableProtectionUnit -OS_DisableProtectionUnit: ; 0x020CC9C8 - mrc p15, 0x0, r0, c1, c0, 0x0 - bic r0, r0, #0x1 - mcr p15, 0x0, r0, c1, c0, 0x0 - bx lr diff --git a/arm9/lib/include/OS_init.h b/arm9/lib/include/OS_init.h index 69d21213..36fc5c8b 100644 --- a/arm9/lib/include/OS_init.h +++ b/arm9/lib/include/OS_init.h @@ -15,6 +15,7 @@ #include "OS_mutex.h" #include "OS_thread.h" #include "OS_protectionRegion.h" +#include "OS_protectionUnit.h" #include "OS_entropy.h" #include "OS_emulator.h" #include "OS_arena.h" diff --git a/arm9/lib/include/OS_protectionUnit.h b/arm9/lib/include/OS_protectionUnit.h new file mode 100644 index 00000000..e7dc32d8 --- /dev/null +++ b/arm9/lib/include/OS_protectionUnit.h @@ -0,0 +1,11 @@ +// +// Created by red031000 on 2020-05-24. +// + +#ifndef POKEDIAMOND_OS_PROTECTIONUNIT_H +#define POKEDIAMOND_OS_PROTECTIONUNIT_H + +void OS_EnableProtectionUnit(void); +void OS_DisableProtectionUnit(void); + +#endif //POKEDIAMOND_OS_PROTECTIONUNIT_H diff --git a/arm9/lib/include/OS_reset.h b/arm9/lib/include/OS_reset.h index c3b60c98..c50106da 100644 --- a/arm9/lib/include/OS_reset.h +++ b/arm9/lib/include/OS_reset.h @@ -12,9 +12,9 @@ #define OS_PXI_COMMAND_SHIFT 8 #define OS_PXI_COMMAND_RESET 0x10 -void OS_InitReset(); -void OSi_CommonCallback(PXIFifoTag tag, u32 data, BOOL err); -void OSi_SendToPxi(u16 data); +void OS_InitReset(void); +static void OSi_CommonCallback(PXIFifoTag tag, u32 data, BOOL err); +static void OSi_SendToPxi(u16 data); void OS_ResetSystem(u32 parameter); #endif //POKEDIAMOND_OS_RESET_H diff --git a/arm9/lib/src/OS_protectionUnit.c b/arm9/lib/src/OS_protectionUnit.c new file mode 100644 index 00000000..be57dcd6 --- /dev/null +++ b/arm9/lib/src/OS_protectionUnit.c @@ -0,0 +1,21 @@ +// +// Created by red031000 on 2020-05-24. +// + +#include "function_target.h" + +ARM_FUNC asm void OS_EnableProtectionUnit(void) +{ + mrc p15, 0x0, r0, c1, c0, 0x0 + orr r0, r0, #0x1 + mcr p15, 0x0, r0, c1, c0, 0x0 + bx lr +} + +ARM_FUNC asm void OS_DisableProtectionUnit(void) +{ + mrc p15, 0x0, r0, c1, c0, 0x0 + bic r0, r0, #0x1 + mcr p15, 0x0, r0, c1, c0, 0x0 + bx lr +} diff --git a/arm9/lib/src/OS_reset.c b/arm9/lib/src/OS_reset.c index 02498962..e051f6ff 100644 --- a/arm9/lib/src/OS_reset.c +++ b/arm9/lib/src/OS_reset.c @@ -11,15 +11,15 @@ static u16 OSi_IsInitReset = 0; vu16 OSi_IsResetOccurred = 0; -extern void PXI_Init(); +extern void PXI_Init(void); extern u32 PXI_IsCallbackReady(u32 param1, u32 param2); extern void PXI_SetFifoRecvCallback(u32 param1, void* callback); extern u32 PXI_SendWordByFifo(u32 param1, u32 data, u32 param2); extern void CARD_LockRom(u16 lockId); extern void MI_StopDma(u32 dma); -extern void OSi_DoResetSystem(); //in itcm, should technically be in this file +extern void OSi_DoResetSystem(void); //in itcm, should technically be in this file -ARM_FUNC void OS_InitReset() { +ARM_FUNC void OS_InitReset(void) { if (OSi_IsInitReset) { return; } |