Skip to content

Commit c158997

Browse files
committed
crash.c -> reset.c (docs, clean up) + osCreateThread consistency
1 parent f6402cf commit c158997

18 files changed

Lines changed: 232 additions & 242 deletions

include/common.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "sys/gfx/animation.h"
2929
#include "sys/gfx/model.h"
3030
#include "sys/di_cpu.h"
31-
#include "sys/crash.h"
3231
#include "sys/asset.h"
3332
#include "sys/generic_stack.h"
3433
#include "sys/generic_queue.h"

include/memory_regions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,9 @@
3434
*/
3535
#define DEPTH_BUFFER_ADDR 0x80200000
3636

37+
/** Static regions to persist some memory across NMI resets (for debugging). */
38+
#define RESET_ASSET_THREAD_COPY ((OSThread *)0x807FF000)
39+
#define RESET_MAIN_THREAD_COPY ((OSThread *)0x807FF230)
40+
#define RESET_DLL_LIST_COPY ((void *)0x807FF460)
41+
3742
#endif

include/sys/asset.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
#include "sys/generic_queue.h"
88
#include "game/objects/object.h"
99

10-
#define ASSET_THREAD_ID 99
11-
#define ASSET_THREAD_PRIORITY 11
12-
1310
enum AssetLoadType {
1411
ASSET_TYPE_FILE = 0,
1512
ASSET_TYPE_ALLOCATED_FILE = 1,

include/sys/crash.h

Lines changed: 0 additions & 46 deletions
This file was deleted.

include/sys/di_cpu.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ void diCpuTraceInit(void);
1010
* Stops all active application threads (those with priorities between 1 and OS_PRIORITY_APPMAX).
1111
*/
1212
void diCpuStopActiveAppThreads(void);
13-
void diCpuDrawCpuInfo(OSThread **threads, s32 count, s32 offset);
14-
void diCpuDrawStackTrace(OSThread**, s32, s32);
15-
void diCpuDrawFpuInfo(OSThread **threads, s32 count, s32 threadIdx);
13+
void diCpuDrawCpuInfo(OSThread** threads, s32 threadsCount, s32 threadsIdx);
14+
void diCpuDrawStackTrace(OSThread** threads, s32 threadsCount, s32 threadsIdx);
15+
void diCpuDrawFpuInfo(OSThread **threads, s32 threadsCount, s32 threadsIdx);
1616
void diCpuCrashScreenInit(void);
17-
void diCpuTraceFile(const char *cFileLabel, s32 line);
17+
void diCpuTraceFile(const char *filename, s32 lineno);
1818

1919
void* diCpuTraceCurrentStack(void);
2020

include/sys/reset.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** NMI handler
2+
*/
3+
#ifndef _SYS_RESET_H
4+
#define _SYS_RESET_H
5+
6+
#include "PR/sched.h"
7+
8+
void resetInit(OSSched *scheduler);
9+
10+
#endif

include/sys/thread.h

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
#ifndef _SYS_THREAD_H
44
#define _SYS_THREAD_H
55

6-
#include "ultra64.h"
7-
#include "PR/sched.h"
8-
96
#define IDLE_THREAD_SIZE 0x40
107
#define IDLE_THREAD_ID 1
118
#define IDLE_THREAD_PRIORITY OS_PRIORITY_IDLE
@@ -15,22 +12,21 @@
1512
#define MAIN_THREAD_PRIORITY 10
1613

1714
#define OS_SCHEDULER_THREAD_ID 5
15+
#define OS_SCHEDULER_THREAD_PRIORITY 13
16+
1817
#define CONTROLLER_THREAD_ID 98
18+
#define CONTROLLER_THREAD_PRIORITY 12
1919

20-
#define CRASH_THREAD_ID 100
21-
#define CRASH_THREAD_PRIORITY 0x80
20+
#define RESET_THREAD_ID 100
21+
#define RESET_THREAD_PRIORITY 0x80
2222

23-
extern OSThread* __osRunningThread;
24-
extern OSThread* __osRunQueue;
25-
// this needs double checking. its address is within gMainThreadStack....
26-
extern u64 gIdleThreadStack[];
27-
extern u64 gMainThreadStack[];
28-
extern OSThread gIdleThread;
29-
extern OSThread gMainThread;
23+
#define ASSET_THREAD_ID 99
24+
#define ASSET_THREAD_PRIORITY 11
3025

31-
/**
32-
* @returns The address of s->interruptQ.
33-
*/
34-
OSMesgQueue *osScGetInterruptQ(OSSched *s);
26+
#define AUDIO_THREAD_ID 4
27+
#define AUDIO_THREAD_PRIORITY 14
28+
29+
#define DI_CPU_THREAD_ID (-1)
30+
#define DI_CPU_THREAD_PRIORITY OS_PRIORITY_MAX
3531

3632
#endif //_SYS_THREAD_H

include/sys/vi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern u16 *gBackDepthBuffer;
2222
extern s32 gDisplayHertz;
2323
extern f32 gAspectRatio; //1.121212 for PAL, 1.333 for NTSC/MPAL.
2424

25-
void viInit(s32 videoMode, OSSched* scheduler, s32 someBool);
25+
void viInit(s32 videoMode, OSSched* scheduler, s32 doOneTimeInit);
2626
/**
2727
* Returns gVideoMode.
2828
*/

splat.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ segments:
7777
- [0x334F0, c, objexpr]
7878
- [0x359E0, c, objprint]
7979
- [0x37C90, c, pi]
80-
- [0x38020, c, crash]
80+
- [0x38020, c, reset]
8181
- [0x38380, c, rcp]
8282
- [0x3A190, c, route]
8383
- [0x3AFB0, c, rarezip]
@@ -320,7 +320,7 @@ segments:
320320
- [0x92310, .data, objlib]
321321
- [0x92320, .data, objexpr]
322322
- [0x92350, .data, objprint]
323-
- [0x92370, .data, crash]
323+
- [0x92370, .data, reset]
324324
- [0x92380, .data, rcp]
325325
- [0x924B0, .data, rarezip]
326326
- [0x924D0, .data, scheduler]
@@ -475,7 +475,7 @@ segments:
475475
# - { type: .bss, vram: 0x800b2e00, name: objexpr }
476476
# - { type: .bss, vram: 0x800b2e10, name: objprint }
477477
# - { type: .bss, vram: 0x800b2e30, name: pi }
478-
# - { type: .bss, vram: 0x800b2ed0, name: crash }
478+
# - { type: .bss, vram: 0x800b2ed0, name: reset }
479479
# - { type: .bss, vram: 0x800b3790, name: rcp }
480480
# - { type: .bss, vram: 0x800b4920, name: route }
481481
# - { type: .bss, vram: 0x800b4930, name: rarezip }

src/asset.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "sys/interrupt_util.h"
66
#include "sys/map.h"
77
#include "sys/objects.h"
8+
#include "sys/thread.h"
89
#include "sys/voxmap.h"
910
#include "macros.h"
1011

0 commit comments

Comments
 (0)