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 | |
| parent | 5b63607ba4ca12c2a2935ea9618b3ffe6a6d3ab3 (diff) | |
| download | psn00bsdk-49ee8172ebb6c77071be113a01fc29c48b991479.tar.gz | |
Remove MDEC indev example, add more kernel APIs
| -rw-r--r-- | indev/README.md | 4 | ||||
| -rw-r--r-- | indev/psxmdec/data.s | 6 | ||||
| -rw-r--r-- | indev/psxmdec/main.c | 93 | ||||
| -rw-r--r-- | indev/psxmdec/output.bullschit | bin | 43200 -> 0 bytes | |||
| -rw-r--r-- | indev/psxmdec/vlc.c | 314 | ||||
| -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 |
9 files changed, 207 insertions, 459 deletions
diff --git a/indev/README.md b/indev/README.md index 8263487..a390d3d 100644 --- a/indev/README.md +++ b/indev/README.md @@ -9,10 +9,6 @@ also go into this directory. ## Lameguy's indev components
-* psxmdec: Prototype component for performing BS image decoding using the
- MDEC. Unfortunately I only got as far as returning garbled pixels from
- the MDEC, which was pretty bull.
-
* libpad: The early beginnings of a pad/card library using routines that
accesses the pad/card interfaces directly. Ideally PSn00bSDK's pad library
should include the functionality of pad/tap/gun peripherals into one
diff --git a/indev/psxmdec/data.s b/indev/psxmdec/data.s deleted file mode 100644 index adf825a..0000000 --- a/indev/psxmdec/data.s +++ /dev/null @@ -1,6 +0,0 @@ -.section .data
-
-.global bs_data
-.type bs_data, @object
-bs_data:
- .incbin "output.bullschit"
diff --git a/indev/psxmdec/main.c b/indev/psxmdec/main.c deleted file mode 100644 index 25baf11..0000000 --- a/indev/psxmdec/main.c +++ /dev/null @@ -1,93 +0,0 @@ -#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <psxgpu.h>
-#include <psxpress.h>
-#include <hwregs_c.h>
-
-#define SCREEN_XRES 320
-#define SCREEN_YRES 240
-
-//#define BLOCK_SIZE 8 // Monochrome (8x8), 15bpp display
-//#define BLOCK_SIZE 12 // Monochrome (8x8), 24bpp display
-//#define BLOCK_SIZE 16 // Color (16x16), 15bpp display
-#define BLOCK_SIZE 24 // Color (16x16), 24bpp display
-
-/* vlc.c */
-int DecDCTvlc( unsigned short *mdec_bs, unsigned short *mdec_rl );
-
-/* data.s */
-extern unsigned short bs_data[];
-
-DISPENV disp;
-
-void init( void )
-{
- ResetGraph(0);
- DecDCTReset(0);
-
- SetDefDispEnv(&disp, 0, 0, SCREEN_XRES, SCREEN_YRES);
-
- disp.isrgb24 = disp.isrgb24 = 1;
-
- PutDispEnv(&disp);
- SetDispMask(1);
-
-} /* init */
-
-
-void decode_test( void )
-{
- uint16_t *out_buff;
- uint16_t dec_len;
-
- // Allocate and decode VLC encoded BS data
- printf("Decode start...\n");
- out_buff = (uint16_t*)malloc(4*((*(long*)bs_data)+1));
- DecDCTvlc(bs_data, out_buff);
-
- // Print out decompression results
- dec_len = ((uint16_t*)out_buff)[0];
- printf("out_buff=%p len=%d\n", out_buff, dec_len);
-
- // Initialize MDEC data input
- MDEC0 = 0x30000000 | dec_len; // 0x38000000 for 15bpp
- DecDCTinRaw((const uint32_t*)(out_buff+1), dec_len);
-
- // Decode image slice-by-slice
- for (uint32_t x = 0; x < (SCREEN_XRES * 3 / 2); x += BLOCK_SIZE)
- { // 24bpp
- RECT rect;
- uint32_t slice[BLOCK_SIZE * SCREEN_YRES / 2];
-
- rect.x = x;
- rect.y = 0;
- rect.w = BLOCK_SIZE;
- rect.h = SCREEN_YRES;
-
- // Configure the MDEC to output to the slice buffer and let it finish
- // decoding a slice, then upload it to the framebuffer.
- DecDCTout(slice, BLOCK_SIZE * SCREEN_YRES / 2);
- DecDCToutSync(0);
-
- LoadImage(&rect, (u_long *) slice);
- DrawSync(0);
- }
-
- free(out_buff);
-
-} /* decode_test */
-
-int main( int argc, const char *argv[] )
-{
- init();
-
- decode_test();
-
- for (;;)
- __asm__ volatile("");
-
- return 0;
-
-} /* main */
diff --git a/indev/psxmdec/output.bullschit b/indev/psxmdec/output.bullschit Binary files differdeleted file mode 100644 index 4229da0..0000000 --- a/indev/psxmdec/output.bullschit +++ /dev/null diff --git a/indev/psxmdec/vlc.c b/indev/psxmdec/vlc.c deleted file mode 100644 index 064cfb3..0000000 --- a/indev/psxmdec/vlc.c +++ /dev/null @@ -1,314 +0,0 @@ -/* This file is a trimmed version of
- * https://cgit.grumpycoder.net/cgit/PSX-Bundle/tree/psxdev/vlc.c
- * that only includes the VLC decompression routine. It cannot be
- * included as part of the PSn00bSDK Run-time libraries due to license
- * incompatibilities but is included here largely for prototyping and
- * reference purposes as a better optimized implementation is preferred
- * to support full-motion-video playback.
- *
- */
-#include <sys/types.h>
-
-typedef unsigned short Uint16;
-typedef unsigned int Uint32;
-
-typedef struct {
- unsigned int code,nbits;
-} huff_t;
-
-//#include "table.h"
-
-#define CODE1(a,b,c) (((a)<<10)|((b)&0x3ff)|((c)<<16))
-/* run, level, bit */
-#define CODE(a,b,c) CODE1(a,b,c+1),CODE1(a,-b,c+1)
-#define CODE0(a,b,c) CODE1(a,b,c),CODE1(a,b,c)
-#define CODE2(a,b,c) CODE1(a,b,c+1),CODE1(a,b,c+1)
-#define RUNOF(a) ((a)>>10)
-#define VALOF(a) ((short)((a)<<6)>>6)
-#define BITOF(a) ((a)>>16)
-#define EOB 0xfe00
-#define ESCAPE_CODE CODE1(63,0,6)
-#define EOB_CODE CODE1(63,512,2)
-
-/*
- DC code
- Y U,V
-0 100 00 0
-1 00x 01x -1,1
-2 01xx 10xx -3,-2,2,3
-3 101xxx 110xxx -7..-4,4..7
-4 110xxxx 1110 -15..-8,8..15
-5 1110xxxxx 11110 -31..-16,16..31
-6 11110xxxxxx 111110 -63..-32,32..63
-7 111110 1111110 -127..-64,64..127
-8 1111110 11111110 -255..-128,128..255
- 7+8 8+8
-*/
-
-/*
- This table based on MPEG2DEC by MPEG Software Simulation Group
-*/
-
-/* Table B-14, DCT coefficients table zero,
-* codes 0100 ... 1xxx (used for all other coefficients)
-*/
-static const Uint32 VLCtabnext[12*2] = {
- CODE(0,2,4), CODE(2,1,4), CODE2(1,1,3), CODE2(1,-1,3),
- CODE0(63,512,2), CODE0(63,512,2), CODE0(63,512,2), CODE0(63,512,2), /*EOB*/
- CODE2(0,1,2), CODE2(0,1,2), CODE2(0,-1,2), CODE2(0,-1,2)
-};
-
-/* Table B-14, DCT coefficients table zero,
-* codes 000001xx ... 00111xxx
-*/
-static const Uint32 VLCtab0[60*2] = {
- CODE0(63,0,6), CODE0(63,0,6),CODE0(63,0,6), CODE0(63,0,6), /* ESCAPE */
- CODE2(2,2,7), CODE2(2,-2,7), CODE2(9,1,7), CODE2(9,-1,7),
- CODE2(0,4,7), CODE2(0,-4,7), CODE2(8,1,7), CODE2(8,-1,7),
- CODE2(7,1,6), CODE2(7,1,6), CODE2(7,-1,6), CODE2(7,-1,6),
- CODE2(6,1,6), CODE2(6,1,6), CODE2(6,-1,6), CODE2(6,-1,6),
- CODE2(1,2,6), CODE2(1,2,6), CODE2(1,-2,6), CODE2(1,-2,6),
- CODE2(5,1,6), CODE2(5,1,6), CODE2(5,-1,6), CODE2(5,-1,6),
- CODE(13,1,8), CODE(0,6,8), CODE(12,1,8), CODE(11,1,8),
- CODE(3,2,8), CODE(1,3,8), CODE(0,5,8), CODE(10,1,8),
- CODE2(0,3,5), CODE2(0,3,5), CODE2(0,3,5), CODE2(0,3,5),
- CODE2(0,-3,5), CODE2(0,-3,5), CODE2(0,-3,5), CODE2(0,-3,5),
- CODE2(4,1,5), CODE2(4,1,5), CODE2(4,1,5), CODE2(4,1,5),
- CODE2(4,-1,5), CODE2(4,-1,5), CODE2(4,-1,5), CODE2(4,-1,5),
- CODE2(3,1,5), CODE2(3,1,5), CODE2(3,1,5), CODE2(3,1,5),
- CODE2(3,-1,5), CODE2(3,-1,5), CODE2(3,-1,5), CODE2(3,-1,5)
-};
-
-/* Table B-14, DCT coefficients table zero,
-* codes 0000001000 ... 0000001111
-*/
-static const Uint32 VLCtab1[8*2] = {
- CODE(16,1,10), CODE(5,2,10), CODE(0,7,10), CODE(2,3,10),
- CODE(1,4,10), CODE(15,1,10), CODE(14,1,10), CODE(4,2,10)
-};
-
-/* Table B-14/15, DCT coefficients table zero / one,
-* codes 000000010000 ... 000000011111
-*/
-static const Uint32 VLCtab2[16*2] = {
- CODE(0,11,12), CODE(8,2,12), CODE(4,3,12), CODE(0,10,12),
- CODE(2,4,12), CODE(7,2,12), CODE(21,1,12), CODE(20,1,12),
- CODE(0,9,12), CODE(19,1,12), CODE(18,1,12), CODE(1,5,12),
- CODE(3,3,12), CODE(0,8,12), CODE(6,2,12), CODE(17,1,12)
-};
-
-/* Table B-14/15, DCT coefficients table zero / one,
-* codes 0000000010000 ... 0000000011111
-*/
-static const Uint32 VLCtab3[16*2] = {
- CODE(10,2,13), CODE(9,2,13), CODE(5,3,13), CODE(3,4,13),
- CODE(2,5,13), CODE(1,7,13), CODE(1,6,13), CODE(0,15,13),
- CODE(0,14,13), CODE(0,13,13), CODE(0,12,13), CODE(26,1,13),
- CODE(25,1,13), CODE(24,1,13), CODE(23,1,13), CODE(22,1,13)
-};
-
-/* Table B-14/15, DCT coefficients table zero / one,
-* codes 00000000010000 ... 00000000011111
-*/
-static const Uint32 VLCtab4[16*2] = {
- CODE(0,31,14), CODE(0,30,14), CODE(0,29,14), CODE(0,28,14),
- CODE(0,27,14), CODE(0,26,14), CODE(0,25,14), CODE(0,24,14),
- CODE(0,23,14), CODE(0,22,14), CODE(0,21,14), CODE(0,20,14),
- CODE(0,19,14), CODE(0,18,14), CODE(0,17,14), CODE(0,16,14)
-};
-
-/* Table B-14/15, DCT coefficients table zero / one,
-* codes 000000000010000 ... 000000000011111
-*/
-static const Uint32 VLCtab5[16*2] = {
- CODE(0,40,15), CODE(0,39,15), CODE(0,38,15), CODE(0,37,15),
- CODE(0,36,15), CODE(0,35,15), CODE(0,34,15), CODE(0,33,15),
- CODE(0,32,15), CODE(1,14,15), CODE(1,13,15), CODE(1,12,15),
- CODE(1,11,15), CODE(1,10,15), CODE(1,9,15), CODE(1,8,15)
-};
-
-/* Table B-14/15, DCT coefficients table zero / one,
-* codes 0000000000010000 ... 0000000000011111
-*/
-static const Uint32 VLCtab6[16*2] = {
- CODE(1,18,16), CODE(1,17,16), CODE(1,16,16), CODE(1,15,16),
- CODE(6,3,16), CODE(16,2,16), CODE(15,2,16), CODE(14,2,16),
- CODE(13,2,16), CODE(12,2,16), CODE(11,2,16), CODE(31,1,16),
- CODE(30,1,16), CODE(29,1,16), CODE(28,1,16), CODE(27,1,16)
-};
-
-/*
- DC code
- Y U,V
-0 100 00 0
-1 00x 01x -1,1
-2 01xx 10xx -3,-2,2,3
-3 101xxx 110xxx -7..-4,4..7
-4 110xxxx 1110xxxx -15..-8,8..15
-5 1110xxxxx 11110xxxxx -31..-16,16..31
-6 11110xxxxxx 111110xxxxxx -63..-32,32..63
-7 111110xxxxxxx 1111110xxxxxxx -127..-64,64..127
-8 1111110xxxxxxxx 11111110xxxxxxxx -255..-128,128..255
-*/
-
-static const Uint32 DC_Ytab0[48] = {
- CODE1(0,-1,3),CODE1(0,-1,3),CODE1(0,-1,3),CODE1(0,-1,3),
- CODE1(0,-1,3),CODE1(0,-1,3),CODE1(0,-1,3),CODE1(0,-1,3),
- CODE1(0,1,3),CODE1(0,1,3),CODE1(0,1,3),CODE1(0,1,3),
- CODE1(0,1,3),CODE1(0,1,3),CODE1(0,1,3),CODE1(0,1,3),
-
- CODE1(0,-3,4),CODE1(0,-3,4),CODE1(0,-3,4),CODE1(0,-3,4),
- CODE1(0,-2,4),CODE1(0,-2,4),CODE1(0,-2,4),CODE1(0,-2,4),
- CODE1(0,2,4),CODE1(0,2,4),CODE1(0,2,4),CODE1(0,2,4),
- CODE1(0,3,4),CODE1(0,3,4),CODE1(0,3,4),CODE1(0,3,4),
-
- CODE1(0,0,3),CODE1(0,0,3),CODE1(0,0,3),CODE1(0,0,3),
- CODE1(0,0,3),CODE1(0,0,3),CODE1(0,0,3),CODE1(0,0,3),
- CODE1(0,-7,6),CODE1(0,-6,6),CODE1(0,-5,6),CODE1(0,-4,6),
- CODE1(0,4,6),CODE1(0,5,6),CODE1(0,6,6),CODE1(0,7,6),
-
-};
-
-static const Uint32 DC_UVtab0[56] = {
- CODE1(0,0,2),CODE1(0,0,2),CODE1(0,0,2),CODE1(0,0,2),
- CODE1(0,0,2),CODE1(0,0,2),CODE1(0,0,2),CODE1(0,0,2),
- CODE1(0,0,2),CODE1(0,0,2),CODE1(0,0,2),CODE1(0,0,2),
- CODE1(0,0,2),CODE1(0,0,2),CODE1(0,0,2),CODE1(0,0,2),
-
- CODE1(0,-1,3),CODE1(0,-1,3),CODE1(0,-1,3),CODE1(0,-1,3),
- CODE1(0,-1,3),CODE1(0,-1,3),CODE1(0,-1,3),CODE1(0,-1,3),
- CODE1(0,1,3),CODE1(0,1,3),CODE1(0,1,3),CODE1(0,1,3),
- CODE1(0,1,3),CODE1(0,1,3),CODE1(0,1,3),CODE1(0,1,3),
-
- CODE1(0,-3,4),CODE1(0,-3,4),CODE1(0,-3,4),CODE1(0,-3,4),
- CODE1(0,-2,4),CODE1(0,-2,4),CODE1(0,-2,4),CODE1(0,-2,4),
- CODE1(0,2,4),CODE1(0,2,4),CODE1(0,2,4),CODE1(0,2,4),
- CODE1(0,3,4),CODE1(0,3,4),CODE1(0,3,4),CODE1(0,3,4),
-
- CODE1(0,-7,6),CODE1(0,-6,6),CODE1(0,-5,6),CODE1(0,-4,6),
- CODE1(0,4,6),CODE1(0,5,6),CODE1(0,6,6),CODE1(0,7,6),
-};
-
-#define DCTSIZE2 64
-
-/* decode one intra coded MPEG-1 block */
-
-#define Show_Bits(N) (bitbuf>>(32-(N)))
-/* 最小有効bit 17 bit*/
-
-#define Flush_Buffer(N) {bitbuf <<=(N);incnt +=(N);while(incnt>=0) {bitbuf |= Get_Word()<<incnt;incnt-=16;}}
-
-#define Init_Buffer() {bitbuf = (mdec_bs[0]<<16)|(mdec_bs[1]);mdec_bs+=2;incnt = -16;}
-
-#define Get_Word() (*mdec_bs++)
-#define Printf printf
-
-int DecDCTvlc(Uint16 *mdec_bs,Uint16 *mdec_rl)
-{
-/* Uint16 *mdec_bs = mdecbs,*mdec_rl = mdecrl */
- Uint16 *rl_end;
- Uint32 bitbuf;
- int incnt; /* 16-有効bit数 x86=char risc = long */
- int q_code;
- int type,n;
- int last_dc[3];
-
-/* BS_HDR Uint16 rlsize,magic,ver,q_scale */
-
- /* printf("%04x,%04x,",mdec_bs[0],mdec_bs[1]); */
- *(long*)mdec_rl=*(long*)mdec_bs;
- mdec_rl+=2;
- rl_end = mdec_rl+(int)mdec_bs[0]*2;
- q_code = (mdec_bs[2]<<10); /* code = q */
- type = mdec_bs[3];
- mdec_bs+=4;
-
- Init_Buffer();
-
- n = 0;
- last_dc[0]=last_dc[1]=last_dc[2] = 0;
- while(mdec_rl<rl_end) {
- Uint32 code2;
- /* DC */
- if (type==2) {
- code2 = Show_Bits(10)|(10<<16); /* DC code */
- } else {
- code2 = Show_Bits(6);
- if (n>=2) {
- /* Y */
- if (code2<48) {
- code2 = DC_Ytab0[code2];
- code2 = (code2&0xffff0000)|((last_dc[2]+=VALOF(code2)*4)&0x3ff);
- } else {
- int nbit,val;
- int bit = 3;
- while(Show_Bits(bit)&1) { bit++;}
- bit++;
- nbit = bit*2-1;
- val = Show_Bits(nbit)&((1<<bit)-1);
- if ((val&(1<<(bit-1)))==0)
- val -= (1<<bit)-1;
- val = (last_dc[2]+=val*4);
- code2 = (nbit<<16) | (val&0x3ff);
- }
- /* printf("%d ",last_dc[2]); */
- } else {
- /* U,V */
- if (code2<56) {
- code2 = DC_UVtab0[code2];
- code2 = (code2&0xffff0000)|((last_dc[n]+=VALOF(code2)*4)&0x3ff);
- } else {
- int nbit,val;
- int bit = 4;
- while(Show_Bits(bit)&1) { bit++;}
- nbit = bit*2;
- val = Show_Bits(nbit)&((1<<bit)-1);
- if ((val&(1<<(bit-1)))==0)
- val -= (1<<bit)-1;
- val = (last_dc[n]+=val*4);
- code2 = (nbit<<16) | (val&0x3ff);
- }
- /* printf("%d ",last_dc[n]); */
- }
- if (++n==6) n=0;
- }
- /* printf("%d ",VALOF(code2)); */
- code2 |= q_code;
-
- /* AC */
- while(mdec_rl<rl_end){
-/* Uint32 code; */
-#define code code2
-#define SBIT 17
- *mdec_rl++=code2;
- Flush_Buffer(BITOF(code2));
- code = Show_Bits(SBIT);
- if (code>=1<<(SBIT- 2)) {
- code2 = VLCtabnext[(code>>12)-8];
- if (code2==EOB_CODE) break;
- }
- else if (code>=1<<(SBIT- 6)) {
- code2 = VLCtab0[(code>>8)-8];
- if (code2==ESCAPE_CODE) {
- Flush_Buffer(6); /* ESCAPE len */
- code2 = Show_Bits(16)| (16<<16);
- }
- }
- else if (code>=1<<(SBIT- 7)) code2 = VLCtab1[(code>>6)-16];
- else if (code>=1<<(SBIT- 8)) code2 = VLCtab2[(code>>4)-32];
- else if (code>=1<<(SBIT- 9)) code2 = VLCtab3[(code>>3)-32];
- else if (code>=1<<(SBIT-10)) code2 = VLCtab4[(code>>2)-32];
- else if (code>=1<<(SBIT-11)) code2 = VLCtab5[(code>>1)-32];
- else if (code>=1<<(SBIT-12)) code2 = VLCtab6[(code>>0)-32];
- else {
- do {
- *mdec_rl++=EOB;
- } while(mdec_rl<rl_end);
- return 0;
- }
- }
- *mdec_rl++=code2; /* EOB code */
- Flush_Buffer(2); /* EOB bitlen */
- }
- return 0;
-}
\ No newline at end of file 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" |
