diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-07-23 23:13:49 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-07-23 23:13:49 +0200 |
| commit | 49ee8172ebb6c77071be113a01fc29c48b991479 (patch) | |
| tree | e3f696b3deb326b7da455bc71d9a0a8d100daa70 /libpsn00b | |
| parent | 5b63607ba4ca12c2a2935ea9618b3ffe6a6d3ab3 (diff) | |
| download | psn00bsdk-49ee8172ebb6c77071be113a01fc29c48b991479.tar.gz | |
Remove MDEC indev example, add more kernel APIs
Diffstat (limited to 'libpsn00b')
| -rw-r--r-- | libpsn00b/psxapi/_syscalls.s | 50 | ||||
| -rw-r--r-- | libpsn00b/psxapi/stubs.json | 70 | ||||
| -rw-r--r-- | libpsn00b/psxapi/sys.s | 114 | ||||
| -rw-r--r-- | libpsn00b/psxetc/_dl_resolve_wrapper.s | 15 |
4 files changed, 207 insertions, 42 deletions
diff --git a/libpsn00b/psxapi/_syscalls.s b/libpsn00b/psxapi/_syscalls.s new file mode 100644 index 0000000..24864f3 --- /dev/null +++ b/libpsn00b/psxapi/_syscalls.s @@ -0,0 +1,50 @@ +# PSn00bSDK syscall wrappers +# (C) 2022 spicyjpeg - MPL licensed + +.set noreorder + +.section .text.EnterCriticalSection +.global EnterCriticalSection +.type EnterCriticalSection, @function +EnterCriticalSection: + li $a0, 0x01 + syscall 0 + + jr $ra + nop + +.section .text.ExitCriticalSection +.global ExitCriticalSection +.type ExitCriticalSection, @function +ExitCriticalSection: + li $a0, 0x02 + syscall 0 + + jr $ra + nop + +.section .text.SwEnterCriticalSection +.global SwEnterCriticalSection +.type SwEnterCriticalSection, @function +SwEnterCriticalSection: + mfc0 $a0, $12 # cop0r12 &= ~0x00000401 + li $a1, -1026 + and $a0, $a1 + mtc0 $a0, $12 + nop + + jr $ra + nop + +.section .text.SwExitCriticalSection +.global SwExitCriticalSection +.type SwExitCriticalSection, @function +SwExitCriticalSection: + mfc0 $a0, $12 # cop0r12 |= 0x00000401 + nop + ori $a0, 0x0401 + mtc0 $a0, $12 + nop + + jr $ra + nop diff --git a/libpsn00b/psxapi/stubs.json b/libpsn00b/psxapi/stubs.json index 9198b06..200cbc7 100644 --- a/libpsn00b/psxapi/stubs.json +++ b/libpsn00b/psxapi/stubs.json @@ -133,6 +133,12 @@ }, { "type": "a", + "id": 156, + "name": "SetConf", + "file": "sys.s" + }, + { + "type": "a", "id": 160, "name": "_boot", "file": "sys.s" @@ -205,12 +211,36 @@ }, { "type": "b", + "id": 7, + "name": "DeliverEvent", + "file": "sys.s" + }, + { + "type": "b", "id": 8, "name": "OpenEvent", "file": "sys.s" }, { "type": "b", + "id": 9, + "name": "CloseEvent", + "file": "sys.s" + }, + { + "type": "b", + "id": 10, + "name": "WaitEvent", + "file": "sys.s" + }, + { + "type": "b", + "id": 11, + "name": "TestEvent", + "file": "sys.s" + }, + { + "type": "b", "id": 12, "name": "EnableEvent", "file": "sys.s" @@ -223,6 +253,24 @@ }, { "type": "b", + "id": 14, + "name": "OpenTh", + "file": "sys.s" + }, + { + "type": "b", + "id": 15, + "name": "CloseTh", + "file": "sys.s" + }, + { + "type": "b", + "id": 16, + "name": "ChangeTh", + "file": "sys.s" + }, + { + "type": "b", "id": 18, "name": "InitPAD", "file": "sys.s" @@ -259,6 +307,12 @@ }, { "type": "b", + "id": 32, + "name": "UnDeliverEvent", + "file": "sys.s" + }, + { + "type": "b", "id": 64, "name": "chdir", "file": "fs.s" @@ -391,20 +445,20 @@ }, { "type": "c", - "id": 10, - "name": "ChangeClearRCnt", + "id": 7, + "name": "InstallExceptionHandlers", "file": "sys.s" }, { - "type": "syscall", - "id": 1, - "name": "EnterCriticalSection", + "type": "c", + "id": 8, + "name": "SysInitMemory", "file": "sys.s" }, { - "type": "syscall", - "id": 2, - "name": "ExitCriticalSection", + "type": "c", + "id": 10, + "name": "ChangeClearRCnt", "file": "sys.s" } ] diff --git a/libpsn00b/psxapi/sys.s b/libpsn00b/psxapi/sys.s index e54bd98..e2505e1 100644 --- a/libpsn00b/psxapi/sys.s +++ b/libpsn00b/psxapi/sys.s @@ -6,7 +6,7 @@ .set noreorder -## A0 table functions (7) +## A0 table functions (8) .section .text.b_setjmp .global b_setjmp @@ -48,6 +48,14 @@ FlushCache: jr $t2 li $t1, 0x44 +.section .text.SetConf +.global SetConf +.type SetConf, @function +SetConf: + li $t2, 0xa0 + jr $t2 + li $t1, 0x9c + .section .text._boot .global _boot .type _boot, @function @@ -64,7 +72,7 @@ GetSystemInfo: jr $t2 li $t1, 0xb4 -## B0 table functions (19) +## B0 table functions (27) .section .text._kernel_malloc .global _kernel_malloc @@ -122,6 +130,14 @@ ResetRCnt: jr $t2 li $t1, 0x06 +.section .text.DeliverEvent +.global DeliverEvent +.type DeliverEvent, @function +DeliverEvent: + li $t2, 0xb0 + jr $t2 + li $t1, 0x07 + .section .text.OpenEvent .global OpenEvent .type OpenEvent, @function @@ -130,6 +146,30 @@ OpenEvent: jr $t2 li $t1, 0x08 +.section .text.CloseEvent +.global CloseEvent +.type CloseEvent, @function +CloseEvent: + li $t2, 0xb0 + jr $t2 + li $t1, 0x09 + +.section .text.WaitEvent +.global WaitEvent +.type WaitEvent, @function +WaitEvent: + li $t2, 0xb0 + jr $t2 + li $t1, 0x0a + +.section .text.TestEvent +.global TestEvent +.type TestEvent, @function +TestEvent: + li $t2, 0xb0 + jr $t2 + li $t1, 0x0b + .section .text.EnableEvent .global EnableEvent .type EnableEvent, @function @@ -146,6 +186,30 @@ DisableEvent: jr $t2 li $t1, 0x0d +.section .text.OpenTh +.global OpenTh +.type OpenTh, @function +OpenTh: + li $t2, 0xb0 + jr $t2 + li $t1, 0x0e + +.section .text.CloseTh +.global CloseTh +.type CloseTh, @function +CloseTh: + li $t2, 0xb0 + jr $t2 + li $t1, 0x0f + +.section .text.ChangeTh +.global ChangeTh +.type ChangeTh, @function +ChangeTh: + li $t2, 0xb0 + jr $t2 + li $t1, 0x10 + .section .text.InitPAD .global InitPAD .type InitPAD, @function @@ -194,6 +258,14 @@ SetCustomExitFromException: jr $t2 li $t1, 0x19 +.section .text.UnDeliverEvent +.global UnDeliverEvent +.type UnDeliverEvent, @function +UnDeliverEvent: + li $t2, 0xb0 + jr $t2 + li $t1, 0x20 + .section .text.GetC0Table .global GetC0Table .type GetC0Table, @function @@ -218,7 +290,7 @@ ChangeClearPAD: jr $t2 li $t1, 0x5b -## C0 table functions (3) +## C0 table functions (5) .section .text.SysEnqIntRP .global SysEnqIntRP @@ -236,6 +308,22 @@ SysDeqIntRP: jr $t2 li $t1, 0x03 +.section .text.InstallExceptionHandlers +.global InstallExceptionHandlers +.type InstallExceptionHandlers, @function +InstallExceptionHandlers: + li $t2, 0xc0 + jr $t2 + li $t1, 0x07 + +.section .text.SysInitMemory +.global SysInitMemory +.type SysInitMemory, @function +SysInitMemory: + li $t2, 0xc0 + jr $t2 + li $t1, 0x08 + .section .text.ChangeClearRCnt .global ChangeClearRCnt .type ChangeClearRCnt, @function @@ -244,23 +332,3 @@ ChangeClearRCnt: jr $t2 li $t1, 0x0a -## Syscalls (2) - -.section .text.EnterCriticalSection -.global EnterCriticalSection -.type EnterCriticalSection, @function -EnterCriticalSection: - li $a0, 0x01 - syscall 0 - jr $ra - nop - -.section .text.ExitCriticalSection -.global ExitCriticalSection -.type ExitCriticalSection, @function -ExitCriticalSection: - li $a0, 0x02 - syscall 0 - jr $ra - nop - diff --git a/libpsn00b/psxetc/_dl_resolve_wrapper.s b/libpsn00b/psxetc/_dl_resolve_wrapper.s index 01ebf3a..eedfa10 100644 --- a/libpsn00b/psxetc/_dl_resolve_wrapper.s +++ b/libpsn00b/psxetc/_dl_resolve_wrapper.s @@ -10,11 +10,11 @@ # - $t8 = index of the function in the .dynsym symbol table # - $t9 = _dl_resolve_wrapper itself's address -.set noreorder -.section .text +.set noreorder -.global _dl_resolve_wrapper -.type _dl_resolve_wrapper, @function +.section .text._dl_resolve_wrapper +.global _dl_resolve_wrapper +.type _dl_resolve_wrapper, @function _dl_resolve_wrapper: # Push the registers we're going to use onto the stack. addiu $sp, -16 @@ -47,10 +47,3 @@ _dl_resolve_wrapper: jr $t0 nop - -.section .data - -.global _dl_credits -.type _dl_credits, @object -_dl_credits: - .asciiz "psxetc runtime dynamic linker by spicyjpeg\n" |
