Skip to content

Instantly share code, notes, and snippets.

@TuxSH
Last active January 7, 2023 17:34
Show Gist options
  • Save TuxSH/0b388c5146967dcdc0d74adc956b5a53 to your computer and use it in GitHub Desktop.
Save TuxSH/0b388c5146967dcdc0d74adc956b5a53 to your computer and use it in GitHub Desktop.
u32 def
typedef u32 Handle;
typedef s32 Result;
typedef s32 LightLock;
struct RecursiveLock
{
LightLock lock;
u32 threadId;
u32 count;
};
struct NotificationEntryListNode;
struct NotificationEntryListNode
{
struct NotificationEntryListNode *prev;
struct NotificationEntryListNode *next;
};
struct NotificationManager
{
NotificationEntryListNode *firstNode;
RecursiveLock lock;
};
struct NotificationEntry;
struct NotificationEntryVtable
{
void (*HandleNotification)(struct NotificationEntry *this);
};
struct NotificationEntry
{
void **vtable;
NotificationEntryListNode node;
u32 notificationId;
} NotificationEntry;
enum ArbitrationType {
ARBITRATION_SIGNAL = 0, ///< Signal #value threads for wake-up.
ARBITRATION_WAIT_IF_LESS_THAN = 1, ///< If the memory at the address is strictly lower than #value, then wait for signal.
ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN = 2, ///< If the memory at the address is strictly lower than #value, then decrement it and wait for signal.
ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT = 3, ///< If the memory at the address is strictly lower than #value, then wait for signal or timeout.
ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN_TIMEOUT = 4, ///< If the memory at the address is strictly lower than #value, then decrement it and wait for signal or timeout.
} ;
enum MemOp
{
MEMOP_FREE = 0x1,
MEMOP_RESERVE = 0x2,
MEMOP_ALLOC = 0x3,
MEMOP_MAP = 0x4,
MEMOP_UNMAP = 0x5,
MEMOP_PROT = 0x6,
MEMOP_REGION_APP = 0x100,
MEMOP_REGION_SYSTEM = 0x200,
MEMOP_REGION_BASE = 0x300,
MEMOP_OP_MASK = 0xFF,
MEMOP_REGION_MASK = 0xF00,
MEMOP_LINEAR_FLAG = 0x10000,
MEMOP_ALLOC_LINEAR = 0x10003,
};
enum MemState
{
MEMSTATE_FREE = 0x0,
MEMSTATE_RESERVED = 0x1,
MEMSTATE_IO = 0x2,
MEMSTATE_STATIC = 0x3,
MEMSTATE_CODE = 0x4,
MEMSTATE_PRIVATE = 0x5,
MEMSTATE_SHARED = 0x6,
MEMSTATE_CONTINUOUS = 0x7,
MEMSTATE_ALIASED = 0x8,
MEMSTATE_ALIAS = 0x9,
MEMSTATE_ALIASCODE = 0xA,
MEMSTATE_LOCKED = 0xB,
};
enum MemPerm
{
MEMPERM_READ = 0x1,
MEMPERM_WRITE = 0x2,
MEMPERM_READWRITE = 0x3,
MEMPERM_EXECUTE = 0x4,
MEMPERM_DONTCARE = 0x10000000,
};
struct MemInfo
{
u32 base_addr;
u32 size;
u32 perm;
u32 state;
};
struct ServiceInfo
{
const char *name;
u8 maxSessions;
};
typedef unsigned __int8 u8;
typedef unsigned __int16 u16;
typedef unsigned __int32 u32;
typedef unsigned __int64 u64;
typedef signed __int8 s8;
typedef signed __int16 s16;
typedef signed __int32 s32;
typedef signed __int64 s64;
typedef volatile unsigned __int8 vu8;
typedef volatile unsigned __int16 vu16;
typedef volatile unsigned __int32 vu32;
typedef volatile unsigned __int64 vu64;
typedef volatile signed __int8 vs8;
typedef volatile signed __int16 vs16;
typedef volatile signed __int32 vs32;
typedef volatile signed __int64 vs64;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment