mirror of
https://github.com/Maschell/dynamic_libs.git
synced 2024-11-25 13:46:52 +01:00
Adds functions needed for TCPGecko
This commit is contained in:
parent
f4d1ac7906
commit
50d7e01313
@ -42,6 +42,15 @@ EXPORT_DECL(s32, OSForceFullRelaunch, void);
|
||||
//! Thread functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
EXPORT_DECL(s32, OSCreateThread, OSThread *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr);
|
||||
|
||||
EXPORT_DECL(void, OSEnableInterrupts, void);
|
||||
EXPORT_DECL(void, __OSClearAndEnableInterrupt, void);
|
||||
EXPORT_DECL(s32, OSIsInterruptEnabled, void);
|
||||
EXPORT_DECL(s32, OSIsDebuggerPresent, void);
|
||||
EXPORT_DECL(void, OSRestoreInterrupts, void);
|
||||
EXPORT_DECL(void, OSSetDABR, s32, s32, s32, s32);
|
||||
EXPORT_DECL(void, OSSetIABR, s32, s32);
|
||||
|
||||
EXPORT_DECL(s32, OSResumeThread, OSThread *thread);
|
||||
EXPORT_DECL(s32, OSSuspendThread, OSThread *thread);
|
||||
EXPORT_DECL(s32, OSIsThreadTerminated, OSThread *thread);
|
||||
@ -91,6 +100,7 @@ EXPORT_DECL(void, DCStoreRange, const void *addr, u32 length);
|
||||
EXPORT_DECL(void, ICInvalidateRange, const void *addr, u32 length);
|
||||
EXPORT_DECL(void*, OSEffectiveToPhysical, const void*);
|
||||
EXPORT_DECL(void*, __OSPhysicalToEffectiveUncached, const void*);
|
||||
EXPORT_DECL(s32, __OSValidateAddressSpaceRange, s32, void*, s32);
|
||||
EXPORT_DECL(s32, __os_snprintf, char* s, s32 n, const char * format, ...);
|
||||
EXPORT_DECL(s32 *, __gh_errno_ptr, void);
|
||||
|
||||
@ -104,6 +114,11 @@ EXPORT_DECL(s32, OSScreenPutFontEx, u32 bufferNum, u32 posX, u32 posY, const cha
|
||||
EXPORT_DECL(s32, OSScreenEnableEx, u32 bufferNum, s32 enable);
|
||||
EXPORT_DECL(u32, OSScreenPutPixelEx, u32 bufferNum, u32 posX, u32 posY, u32 color);
|
||||
|
||||
EXPORT_DECL(void, DisassemblePPCRange, void *, void *, DisasmReport, DisasmGetSym, u32);
|
||||
EXPORT_DECL(bool, DisassemblePPCOpcode, u32 *, char *, u32, DisasmGetSym, u32);
|
||||
EXPORT_DECL(void*, OSGetSymbolName, u32, u8 *, u32);
|
||||
EXPORT_DECL(int, OSIsDebuggerInitialized, void);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Memory functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -121,7 +136,7 @@ EXPORT_DECL(void *, MEMDestroyExpHeap, s32 heap);
|
||||
EXPORT_DECL(void, MEMFreeToExpHeap, s32 heap, void* ptr);
|
||||
EXPORT_DECL(void *, OSAllocFromSystem, u32 size, s32 alignment);
|
||||
EXPORT_DECL(void, OSFreeToSystem, void *addr);
|
||||
EXPORT_DECL(s32, OSIsAddressValid, void *ptr);
|
||||
EXPORT_DECL(s32, OSIsAddressValid, const void *ptr);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! MCP functions
|
||||
@ -241,6 +256,7 @@ void InitOSFunctionPointers(void)
|
||||
OS_FIND_EXPORT(coreinit_handle, ICInvalidateRange);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSEffectiveToPhysical);
|
||||
OS_FIND_EXPORT(coreinit_handle, __OSPhysicalToEffectiveUncached);
|
||||
OS_FIND_EXPORT(coreinit_handle, __OSValidateAddressSpaceRange);
|
||||
OS_FIND_EXPORT(coreinit_handle, __os_snprintf);
|
||||
OS_FIND_EXPORT(coreinit_handle, __gh_errno_ptr);
|
||||
|
||||
@ -255,9 +271,22 @@ void InitOSFunctionPointers(void)
|
||||
OS_FIND_EXPORT(coreinit_handle, OSScreenPutFontEx);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSScreenEnableEx);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSScreenPutPixelEx);
|
||||
|
||||
OS_FIND_EXPORT(coreinit_handle, DisassemblePPCRange);
|
||||
OS_FIND_EXPORT(coreinit_handle, DisassemblePPCOpcode);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetSymbolName);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSIsDebuggerInitialized);
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Thread functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
OS_FIND_EXPORT(coreinit_handle, OSEnableInterrupts);
|
||||
OS_FIND_EXPORT(coreinit_handle, __OSClearAndEnableInterrupt);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSIsInterruptEnabled);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSIsDebuggerPresent);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSRestoreInterrupts);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSSetDABR);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSSetIABR);
|
||||
|
||||
OS_FIND_EXPORT(coreinit_handle, OSCreateThread);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSResumeThread);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSSuspendThread);
|
||||
|
@ -32,6 +32,36 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Disassembler */
|
||||
typedef void (*DisasmReport)(char *outputBuffer, ...);
|
||||
|
||||
typedef void *(*DisasmGetSym)(u32 addr, u8 *symbolName, u32 nameBufSize);
|
||||
|
||||
#define PPC_DISASM_MAX_BUFFER 64
|
||||
|
||||
#define PPC_DISASM_DEFAULT 0x00000000 // use defaults
|
||||
#define PPC_DISASM_SIMPLIFY 0x00000001 // use simplified mnemonics
|
||||
#define PPC_DISASM_REG_SPACES 0x00000020 // emit spaces between registers
|
||||
#define PPC_DISASM_EMIT_DISASM 0x00000040 // emit only disassembly
|
||||
#define PPC_DISASM_EMIT_ADDR 0x00000080 // emit only addresses + disassembly
|
||||
#define PPC_DISASM_EMIT_FUNCS 0x00000100 // emit function names before and during disassembly
|
||||
|
||||
/* zlib */
|
||||
|
||||
/*#define Z_NO_COMPRESSION 0
|
||||
#define Z_BEST_SPEED 1
|
||||
#define Z_BEST_COMPRESSION 9
|
||||
#define Z_DEFAULT_COMPRESSION (-1)
|
||||
#define Z_OK 0
|
||||
#define Z_STREAM_END 1
|
||||
#define Z_NEED_DICT 2
|
||||
#define Z_ERRNO (-1)
|
||||
#define Z_STREAM_ERROR (-2)
|
||||
#define Z_DATA_ERROR (-3)
|
||||
#define Z_MEM_ERROR (-4)
|
||||
#define Z_BUF_ERROR (-5)
|
||||
#define Z_VERSION_ERROR (-6)*/
|
||||
|
||||
#define BUS_SPEED 248625000
|
||||
#define SECS_TO_TICKS(sec) (((unsigned long long)(sec)) * (BUS_SPEED/4))
|
||||
#define MILLISECS_TO_TICKS(msec) (SECS_TO_TICKS(msec) / 1000)
|
||||
@ -81,6 +111,16 @@ extern s32 (* OSForceFullRelaunch)(void);
|
||||
//! Thread functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern s32 (* OSCreateThread)(OSThread *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr);
|
||||
|
||||
extern void (*OSEnableInterrupts)(void);
|
||||
extern void (*__OSClearAndEnableInterrupt)(void);
|
||||
extern s32 (*OSIsInterruptEnabled)(void);
|
||||
extern s32 (*OSIsDebuggerPresent)(void);
|
||||
|
||||
extern void (*OSRestoreInterrupts)(void);
|
||||
extern void (*OSSetDABR)(s32, s32, s32, s32);
|
||||
extern void (*OSSetIABR)(s32, s32);
|
||||
|
||||
extern s32 (* OSResumeThread)(OSThread *thread);
|
||||
extern s32 (* OSSuspendThread)(OSThread *thread);
|
||||
extern s32 (* OSIsThreadTerminated)(OSThread *thread);
|
||||
@ -129,6 +169,7 @@ extern void (* DCStoreRange)(const void *addr, u32 length);
|
||||
extern void (* ICInvalidateRange)(const void *addr, u32 length);
|
||||
extern void* (* OSEffectiveToPhysical)(const void*);
|
||||
extern void* (* __OSPhysicalToEffectiveUncached)(const void*);
|
||||
extern s32 (* __OSValidateAddressSpaceRange)(s32, void*, s32);
|
||||
extern s32 (* __os_snprintf)(char* s, s32 n, const char * format, ...);
|
||||
extern s32 * (* __gh_errno_ptr)(void);
|
||||
|
||||
@ -147,6 +188,11 @@ extern void * (* OSSetExceptionCallback)(u8 exceptionType, exception_callback ne
|
||||
extern void * (* OSSetExceptionCallbackEx)(s32 unknwn,u8 exceptionType, exception_callback newCallback);
|
||||
extern void (* OSLoadContext)(OSContext * context);
|
||||
|
||||
extern void (*DisassemblePPCRange)(void *rangeStart, void *rangeEnd, DisasmReport disasmReport, DisasmGetSym disasmGetSym, u32 disasmOptions);
|
||||
extern bool (*DisassemblePPCOpcode)(u32 *opcode, char *outputBuffer, u32 bufferSize, DisasmGetSym disasmGetSym, u32 disasmOptions);
|
||||
extern void *(*OSGetSymbolName)(u32 addr, u8 *symbolName, u32 nameBufSize);
|
||||
extern int (*OSIsDebuggerInitialized)(void);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Memory functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -164,7 +210,7 @@ extern void *(* MEMDestroyExpHeap)(s32 heap);
|
||||
extern void (* MEMFreeToExpHeap)(s32 heap, void* ptr);
|
||||
extern void* (* OSAllocFromSystem)(u32 size, s32 alignment);
|
||||
extern void (* OSFreeToSystem)(void *addr);
|
||||
extern s32 (* OSIsAddressValid)(void *ptr);
|
||||
extern s32 (* OSIsAddressValid)(const void *ptr);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! MCP functions
|
||||
|
10
os_types.h
10
os_types.h
@ -17,6 +17,16 @@ extern "C" {
|
||||
#define OS_EXCEPTION_MODE_THREAD 1
|
||||
#define OS_EXCEPTION_MODE_GLOBAL_ALL_CORES 4
|
||||
|
||||
#define OS_THREAD_ATTR_AFFINITY_NONE 0x0007u // affinity to run on every core
|
||||
#define OS_THREAD_ATTR_AFFINITY_CORE0 0x0001u // run only on core0
|
||||
#define OS_THREAD_ATTR_AFFINITY_CORE1 0x0002u // run only on core1
|
||||
#define OS_THREAD_ATTR_AFFINITY_CORE2 0x0004u // run only on core2
|
||||
#define OS_THREAD_ATTR_DETACH 0x0008u // detached
|
||||
#define OS_THREAD_ATTR_PINNED_AFFINITY 0x0010u // pinned (affinitized) to a single core
|
||||
#define OS_THREAD_ATTR_CHECK_STACK_USE 0x0040u // check for stack usage
|
||||
#define OS_THREAD_ATTR_NAME_SENT 0x0080u // debugger has seen the name
|
||||
#define OS_THREAD_ATTR_LAST (OS_THREAD_ATTR_DETACH | OS_THREAD_ATTR_PINNED_AFFINITY | OS_THREAD_ATTR_AFFINITY_NONE)
|
||||
|
||||
typedef struct OSThread_ OSThread;
|
||||
|
||||
struct OSThreadLink {
|
||||
|
@ -32,6 +32,8 @@ extern u32 nsysnet_handle;
|
||||
|
||||
#include <gctypes.h>
|
||||
|
||||
extern u32 hostIpAddress;
|
||||
|
||||
#define INADDR_ANY 0
|
||||
#define INADDR_BROADCAST 0xFFFFFFFF
|
||||
|
||||
@ -61,7 +63,6 @@ extern u32 nsysnet_handle;
|
||||
#define ntohl(x) x
|
||||
#define ntohs(x) x
|
||||
|
||||
|
||||
struct in_addr {
|
||||
u32 s_addr;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user