-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Almost match all of Runtime.PPCEABI.H (STOLEN)
Stolen Runtime.PPCEABI.H from Pikmin2, most of it matched instantly but a couple of changes were required. Sadly, ExceptionPPC.cp I couldn't match, as well as a couple finicky linker section things which I have no idea how they work.
- Loading branch information
Showing
15 changed files
with
1,237 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef _RUNTIME_MWCPLUSLIB_H | ||
#define _RUNTIME_MWCPLUSLIB_H | ||
|
||
#include "stddef.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define CTORARG_TYPE int | ||
#define CTORARG_PARTIAL (0) | ||
#define CTORARG_COMPLETE (1) | ||
|
||
#define CTORCALL_COMPLETE(ctor, objptr) (((void (*)(void*, CTORARG_TYPE))ctor)(objptr, CTORARG_COMPLETE)) | ||
|
||
#define DTORARG_TYPE int | ||
|
||
#define DTORCALL_COMPLETE(dtor, objptr) (((void (*)(void*, DTORARG_TYPE))dtor)(objptr, -1)) | ||
#define DTORCALL_PARTIAL(dtor, objptr) (((void (*)(void*, DTORARG_TYPE))dtor)(objptr, 0)) | ||
|
||
typedef void* ConstructorDestructor; | ||
|
||
extern void __construct_array(void* ptr, ConstructorDestructor ctor, ConstructorDestructor dtor, size_t size, size_t n); | ||
extern void __destroy_arr(void* block, ConstructorDestructor* dtor, size_t size, size_t n); | ||
extern void* __construct_new_array(void* block, ConstructorDestructor ctor, ConstructorDestructor dtor_arg, size_t size, size_t n); | ||
extern void __destroy_new_array(void* block, ConstructorDestructor dtor); | ||
extern void __destroy_new_array2(); | ||
extern void __destroy_new_array3(); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef _NMWEXCEPTION | ||
#define _NMWEXCEPTION | ||
|
||
#include "dolphin/types.h" | ||
#include "Runtime.PPCEABI.H/__ppc_eabi_linker.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef s16 vbase_ctor_arg_type; | ||
typedef char local_cond_type; | ||
|
||
typedef struct CatchInfo { | ||
void* location; | ||
void* typeinfo; | ||
void* dtor; | ||
void* sublocation; | ||
s32 pointercopy; | ||
void* stacktop; | ||
} CatchInfo; | ||
|
||
typedef struct DestructorChain { | ||
struct DestructorChain* next; | ||
void* destructor; | ||
void* object; | ||
} DestructorChain; | ||
|
||
extern void* __register_global_object(void* object, void* destructor, void* registration); | ||
extern void __destroy_global_chain(void); | ||
|
||
extern void __end__catch(CatchInfo* catchinfo); | ||
extern void __throw(char* throwtype, void* location, void* dtor); | ||
extern char __throw_catch_compare(const char* throwtype, const char* catchtype, s32* offset_result); | ||
extern void __unexpected(CatchInfo* catchinfo); | ||
|
||
extern int __register_fragment(struct __eti_init_info* info, char* TOC); | ||
extern void __unregister_fragment(int fragmentID); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // _NMWEXCEPTION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#ifndef __PPC_EABI_LINKER | ||
#define __PPC_EABI_LINKER | ||
|
||
__declspec(section ".init") extern char _stack_addr[]; | ||
__declspec(section ".init") extern char _stack_end[]; | ||
__declspec(section ".init") extern char _heap_addr[]; | ||
__declspec(section ".init") extern char _heap_end[]; | ||
__declspec(section ".init") extern const char _fextabindex_rom[]; | ||
__declspec(section ".init") extern char _fextabindex[]; | ||
__declspec(section ".init") extern char _eextabindex[]; | ||
|
||
__declspec(section ".init") extern char _SDA_BASE_[]; | ||
|
||
__declspec(section ".init") extern char _SDA2_BASE_[]; | ||
|
||
typedef struct __rom_copy_info { | ||
char* rom; | ||
char* addr; | ||
unsigned int size; | ||
} __rom_copy_info; | ||
|
||
__declspec(section ".init") extern __rom_copy_info _rom_copy_info[]; | ||
|
||
typedef struct __bss_init_info { | ||
char* addr; | ||
unsigned int size; | ||
} __bss_init_info; | ||
|
||
__declspec(section ".init") extern __bss_init_info _bss_init_info[]; | ||
|
||
typedef struct __eti_init_info { | ||
void* eti_start; | ||
void* eti_end; | ||
void* code_start; | ||
unsigned long code_size; | ||
} __eti_init_info; | ||
|
||
__declspec(section ".init") extern __eti_init_info _eti_init_info[]; | ||
__declspec(section ".init") extern const char _f_init_rom[]; | ||
__declspec(section ".init") extern char _f_init[]; | ||
__declspec(section ".init") extern char _e_init[]; | ||
__declspec(section ".init") extern const char _f_text_rom[]; | ||
__declspec(section ".init") extern char _f_text[]; | ||
__declspec(section ".init") extern char _e_text[]; | ||
__declspec(section ".init") extern const char _f_rodata_rom[]; | ||
__declspec(section ".init") extern char _f_rodata[]; | ||
__declspec(section ".init") extern char _e_rodata[]; | ||
__declspec(section ".init") extern const char _fextab_rom[]; | ||
__declspec(section ".init") extern char _fextab[]; | ||
__declspec(section ".init") extern char _eextab[]; | ||
__declspec(section ".init") extern const char _f_data_rom[]; | ||
__declspec(section ".init") extern char _f_data[]; | ||
__declspec(section ".init") extern char _e_data[]; | ||
__declspec(section ".init") extern char _f_bss[]; | ||
__declspec(section ".init") extern char _e_bss[]; | ||
__declspec(section ".init") extern const char _f_sdata_rom[]; | ||
__declspec(section ".init") extern char _f_sdata[]; | ||
__declspec(section ".init") extern char _e_sdata[]; | ||
__declspec(section ".init") extern char _f_sbss[]; | ||
__declspec(section ".init") extern char _e_sbss[]; | ||
__declspec(section ".init") extern const char _f_sdata2_rom[]; | ||
__declspec(section ".init") extern char _f_sdata2[]; | ||
__declspec(section ".init") extern char _e_sdata2[]; | ||
__declspec(section ".init") extern char _f_sbss2[]; | ||
__declspec(section ".init") extern char _e_sbss2[]; | ||
__declspec(section ".init") extern const char _f_PPC_EMB_sdata0_rom[]; | ||
__declspec(section ".init") extern char _f_PPC_EMB_sdata0[]; | ||
__declspec(section ".init") extern char _e_PPC_EMB_sdata0[]; | ||
__declspec(section ".init") extern char _f_PPC_EMB_sbss0[]; | ||
__declspec(section ".init") extern char _e_PPC_EMB_sbss0[]; | ||
|
||
#endif // __PPC_EABI_LINKER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef _GLOBALDESTRUCTORCHAIN | ||
#define _GLOBALDESTRUCTORCHAIN | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define CTORARG_TYPE int | ||
#define CTORARG_PARTIAL (0) | ||
#define CTORARG_COMPLETE (1) | ||
|
||
#define CTORCALL_COMPLETE(ctor, objptr) (((void (*)(void*, CTORARG_TYPE))ctor)(objptr, CTORARG_COMPLETE)) | ||
|
||
#define DTORARG_TYPE int | ||
|
||
#define DTORCALL_COMPLETE(dtor, objptr) (((void (*)(void*, DTORARG_TYPE))dtor)(objptr, -1)) | ||
|
||
typedef struct DestructorChain { | ||
struct DestructorChain* next; | ||
void* destructor; | ||
void* object; | ||
} DestructorChain; | ||
|
||
void* __register_global_object(void* object, void* destructor, void* registration); | ||
|
||
void __destroy_global_chain(void); | ||
|
||
int __register_atexit(void (*)(void)); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef _DOLPHIN_RUNTIME_H | ||
#define _DOLPHIN_RUNTIME_H | ||
|
||
#include "dolphin/types.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // ifdef __cplusplus | ||
|
||
u32 __cvt_fp2unsigned(f64); | ||
// TODO: The rest | ||
|
||
void* __copy(char*, char*, size_t); | ||
|
||
#ifdef __cplusplus | ||
}; | ||
#endif // ifdef __cplusplus | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "Runtime.PPCEABI.H/NMWException.h" | ||
#include "Runtime.PPCEABI.H/__ppc_eabi_linker.h" | ||
|
||
typedef struct ProcessInfo { | ||
__eti_init_info* exception_info; | ||
char* TOC; | ||
int active; | ||
} ProcessInfo; | ||
|
||
#define MAXFRAGMENTS 1 | ||
static ProcessInfo fragmentinfo[MAXFRAGMENTS]; | ||
|
||
int __register_fragment(struct __eti_init_info* info, char* TOC) | ||
{ | ||
ProcessInfo* f = fragmentinfo; | ||
int i; | ||
|
||
for (i = 0; i < MAXFRAGMENTS; i++, f++) { | ||
if (f->active == 0) { | ||
f->exception_info = info; | ||
f->TOC = TOC; | ||
f->active = 1; | ||
return i; | ||
} | ||
} | ||
|
||
return -1; | ||
} | ||
|
||
void __unregister_fragment(int fragmentID) | ||
{ | ||
ProcessInfo* f; | ||
|
||
if (fragmentID >= 0 && fragmentID < MAXFRAGMENTS) { | ||
f = &fragmentinfo[fragmentID]; | ||
f->exception_info = 0; | ||
f->TOC = 0; | ||
f->active = 0; | ||
} | ||
} |
Oops, something went wrong.