From e2778a45cf379270c3039aab16bb607178561cc1 Mon Sep 17 00:00:00 2001 From: PabloMK7 Date: Tue, 31 Oct 2023 18:38:40 +0100 Subject: [PATCH] Fix macro change in libctru --- k11_extension/include/kernel.h | 44 +++++++++---------- k11_extension/include/types.h | 8 ++-- k11_extension/source/debug.c | 6 +-- k11_extension/source/main.c | 2 +- k11_extension/source/svc/SetGpuProt.c | 2 +- sysmodules/loader/source/main.c | 2 +- sysmodules/pm/source/main.c | 6 +-- sysmodules/pxi/source/common.h | 2 +- sysmodules/pxi/source/main.c | 8 ++-- sysmodules/rosalina/include/plugin/3gx.h | 10 ++--- sysmodules/rosalina/source/bootdiag.c | 2 +- sysmodules/rosalina/source/errdisp.c | 2 +- sysmodules/rosalina/source/gdb/tio.c | 2 +- .../rosalina/source/input_redirection.c | 2 +- sysmodules/rosalina/source/menu.c | 2 +- sysmodules/rosalina/source/menus/debugger.c | 4 +- sysmodules/rosalina/source/task_runner.c | 2 +- sysmodules/sm/source/main.c | 2 +- 18 files changed, 54 insertions(+), 54 deletions(-) diff --git a/k11_extension/include/kernel.h b/k11_extension/include/kernel.h index 8b3c002..d7417a5 100644 --- a/k11_extension/include/kernel.h +++ b/k11_extension/include/kernel.h @@ -53,7 +53,7 @@ struct KMutexLinkedList; struct KPreemptionTimer; /* 12 */ -typedef struct ALIGN(4) KAutoObject +typedef struct CTR_ALIGN(4) KAutoObject { struct Vtable__KAutoObject *vtable; u32 refCount; @@ -96,7 +96,7 @@ typedef struct KMutexLinkedListNode } KMutexLinkedListNode; /* 1 */ -typedef struct ALIGN(4) KMutex +typedef struct CTR_ALIGN(4) KMutex { KSynchronizationObject syncObject; KMutexLinkedListNode mutexListNode; @@ -153,7 +153,7 @@ typedef struct KClassToken } KClassToken; /* 44 */ -typedef struct ALIGN(4) Vtable__KAutoObject +typedef struct CTR_ALIGN(4) Vtable__KAutoObject { void *field_0; void *field_4; @@ -174,7 +174,7 @@ typedef struct KBaseInterruptEvent } KBaseInterruptEvent; /* 55 */ -typedef struct ALIGN(4) Vtable__KBaseInterruptEvent +typedef struct CTR_ALIGN(4) Vtable__KBaseInterruptEvent { struct KSchedulableInterruptEvent *(*handleInterruptEvent)(KBaseInterruptEvent *, u32); } Vtable__KBaseInterruptEvent; @@ -210,7 +210,7 @@ typedef struct KThreadLinkedListNode /* 93 */ -typedef struct ALIGN(4) KPreemptionTimer +typedef struct CTR_ALIGN(4) KPreemptionTimer { u32 nLimitedTicks; u32 timer; @@ -219,7 +219,7 @@ typedef struct ALIGN(4) KPreemptionTimer } KPreemptionTimer; /* 15 */ -typedef struct PACKED ALIGN(4) KThread +typedef struct CTR_PACKED CTR_ALIGN(4) KThread { KSynchronizationObject syncObject; KTimeableInterruptEvent timeableInterruptEvent; @@ -277,7 +277,7 @@ typedef enum ProcessStatus } ProcessStatus; /* 3 */ -typedef struct ALIGN(4) HandleDescriptor +typedef struct CTR_ALIGN(4) HandleDescriptor { u32 info; KAutoObject *pointer; @@ -297,7 +297,7 @@ typedef struct KProcessHandleTable } KProcessHandleTable; /* 4 */ -typedef struct ALIGN(4) KDebugThread +typedef struct CTR_ALIGN(4) KDebugThread { KThread *linkedThread; bool usedSvcBreak; @@ -355,7 +355,7 @@ typedef enum { } ExceptionEventType; /* 6 */ -typedef struct ALIGN(4) KDebug +typedef struct CTR_ALIGN(4) KDebug { KSynchronizationObject syncObject; KSendableInterruptEvent sendableInterruptEvent; @@ -422,7 +422,7 @@ typedef struct KCodeSetMemDescriptor } KCodeSetMemDescriptor; /* 5 */ -typedef struct PACKED ALIGN(4) KCodeSet +typedef struct CTR_PACKED CTR_ALIGN(4) KCodeSet { KAutoObject autoObject; KCodeSetMemDescriptor textSection; @@ -497,7 +497,7 @@ typedef struct KUserBindableInterruptEvent } KUserBindableInterruptEvent; /* 14 */ -typedef struct ALIGN(4) KEvent +typedef struct CTR_ALIGN(4) KEvent { KSynchronizationObject syncObject; KUserBindableInterruptEvent userBindableInterruptEvent; @@ -601,7 +601,7 @@ typedef struct KMemoryBlock } KMemoryBlock; /* 28 */ -typedef struct ALIGN(4) KScheduler +typedef struct CTR_ALIGN(4) KScheduler { KSchedulableInterruptEvent interruptEvent; u32 threadSwitchAttempts; @@ -619,7 +619,7 @@ typedef struct ALIGN(4) KScheduler } KScheduler; /* 46 */ -typedef struct PACKED CodeSetInfo +typedef struct CTR_PACKED CodeSetInfo { char name[8]; u16 unknown_1; @@ -639,7 +639,7 @@ typedef struct PACKED CodeSetInfo } CodeSetInfo; /* 53 */ -typedef struct ALIGN(4) InterruptData +typedef struct CTR_ALIGN(4) InterruptData { KBaseInterruptEvent *interruptEvent; bool disableUponReceipt; @@ -740,7 +740,7 @@ typedef enum ResetType } ResetType; /* 81 */ -typedef struct PACKED ALIGN(4) KTimer +typedef struct CTR_PACKED CTR_ALIGN(4) KTimer { KSynchronizationObject syncObject; KTimeableInterruptEvent timeableInterruptEvent; @@ -768,7 +768,7 @@ typedef KSchedulableInterruptEvent KThreadTerminationInterruptEvent; typedef KSchedulableInterruptEvent KThreadExitInterruptEvent; /* 89 */ -typedef struct ALIGN(4) KInterruptEventMailbox +typedef struct CTR_ALIGN(4) KInterruptEventMailbox { u32 mailboxID; KSendableInterruptEvent *first; @@ -795,7 +795,7 @@ typedef enum LimitableResource } LimitableResource; /* 99 */ -typedef struct ALIGN(4) CpuRegisters +typedef struct CTR_ALIGN(4) CpuRegisters { u32 r[13]; u32 sp; @@ -809,7 +809,7 @@ typedef struct FpuRegisters { union { - struct PACKED { double d[16]; }; + struct CTR_PACKED { double d[16]; }; float s[32]; }; u32 fpscr; @@ -974,7 +974,7 @@ typedef struct KEventInfo }; } KEventInfo; -typedef struct ALIGN(0x1000) KCoreObjectContext +typedef struct CTR_ALIGN(0x1000) KCoreObjectContext { KThread *volatile currentThread; union KProcess *volatile currentProcess; @@ -1004,7 +1004,7 @@ extern KCoreContext *coreCtxs; #define DEFINE_CONSOLE_SPECIFIC_STRUCTS(console, nbCores) /* 60 */ -typedef struct ALIGN(4) KProcessHwInfoN3DS +typedef struct CTR_ALIGN(4) KProcessHwInfoN3DS { KObjectMutex mutex; u32 processTLBEntriesNeedToBeFlushedOnCore[4]; @@ -1023,7 +1023,7 @@ typedef struct ALIGN(4) KProcessHwInfoN3DS u32 *mmuTableVA; } KProcessHwInfoN3DS; -typedef struct ALIGN(4) KProcessHwInfoO3DS8x +typedef struct CTR_ALIGN(4) KProcessHwInfoO3DS8x { KObjectMutex mutex; u32 processTLBEntriesNeedToBeFlushedOnCore[2]; @@ -1042,7 +1042,7 @@ typedef struct ALIGN(4) KProcessHwInfoO3DS8x u32 *mmuTableVA; } KProcessHwInfoO3DS8x; -typedef struct ALIGN(4) KProcessHwInfoO3DSPre8x +typedef struct CTR_ALIGN(4) KProcessHwInfoO3DSPre8x { KObjectMutex mutex; u32 processTLBEntriesNeedToBeFlushedOnCore[2]; diff --git a/k11_extension/include/types.h b/k11_extension/include/types.h index 2b6c2b0..f921718 100644 --- a/k11_extension/include/types.h +++ b/k11_extension/include/types.h @@ -69,11 +69,11 @@ typedef s32 Result; ///< Function result. #define BIT(n) (1U<<(n)) /// Aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m. -#define ALIGN(m) __attribute__((aligned(m))) +#define CTR_ALIGN(m) __attribute__((aligned(m))) /// Packs a struct (and other types?) so it won't include padding bytes. -#define PACKED __attribute__((packed)) -#define USED __attribute__((used)) -#define UNUSED __attribute__((unused)) +#define CTR_PACKED __attribute__((packed)) +#define CTR_USED __attribute__((used)) +#define CTR_UNUSED __attribute__((unused)) /// Packs a system version from its components. #define SYSTEM_VERSION(major, minor, revision) \ (((major)<<24)|((minor)<<16)|((revision)<<8)) diff --git a/k11_extension/source/debug.c b/k11_extension/source/debug.c index 8f46acb..0bf24ba 100644 --- a/k11_extension/source/debug.c +++ b/k11_extension/source/debug.c @@ -31,7 +31,7 @@ KRecursiveLock dbgParamsLock = { NULL }; u32 dbgParamWatchpointId, dbgParamDVA, dbgParamWCR, dbgParamContextId; -KSchedulableInterruptEvent *enableMonitorModeDebugging(KBaseInterruptEvent *this UNUSED, u32 interruptID UNUSED) +KSchedulableInterruptEvent *enableMonitorModeDebugging(KBaseInterruptEvent *this CTR_UNUSED, u32 interruptID CTR_UNUSED) { coreBarrier(); @@ -76,7 +76,7 @@ static void disableWatchpoint1(void) __asm__ __volatile__("mcr p14, 0, %[val], c0, c5, 5" :: [val] "r" (control)); } -KSchedulableInterruptEvent *disableWatchpoint(KBaseInterruptEvent *this UNUSED, u32 interruptID UNUSED) +KSchedulableInterruptEvent *disableWatchpoint(KBaseInterruptEvent *this CTR_UNUSED, u32 interruptID CTR_UNUSED) { coreBarrier(); @@ -131,7 +131,7 @@ static void setWatchpoint1WithContextId(u32 DVA, u32 WCR, u32 contextId) __asm__ __volatile__("mcr p15, 0, %[val], c7, c10, 5" :: [val] "r" (0) : "memory"); // DMB } -KSchedulableInterruptEvent *setWatchpointWithContextId(KBaseInterruptEvent *this UNUSED, u32 interruptID UNUSED) +KSchedulableInterruptEvent *setWatchpointWithContextId(KBaseInterruptEvent *this CTR_UNUSED, u32 interruptID CTR_UNUSED) { coreBarrier(); diff --git a/k11_extension/source/main.c b/k11_extension/source/main.c index 8210be6..e840b11 100644 --- a/k11_extension/source/main.c +++ b/k11_extension/source/main.c @@ -46,7 +46,7 @@ struct KExtParameters CfwInfo cfwInfo; } kExtParameters = { .basePA = 0x12345678 }; // place this in .data -static ALIGN(1024) u32 g_L2Table[256] = {0}; +static CTR_ALIGN(1024) u32 g_L2Table[256] = {0}; void relocateAndSetupMMU(u32 coreId, u32 *L1Table) { diff --git a/k11_extension/source/svc/SetGpuProt.c b/k11_extension/source/svc/SetGpuProt.c index 9d02a95..faed2e1 100644 --- a/k11_extension/source/svc/SetGpuProt.c +++ b/k11_extension/source/svc/SetGpuProt.c @@ -26,7 +26,7 @@ #include "svc/SetGpuProt.h" -Result SetGpuProt(bool prot UNUSED) +Result SetGpuProt(bool prot CTR_UNUSED) { return 0; } diff --git a/sysmodules/loader/source/main.c b/sysmodules/loader/source/main.c index a039b5b..9ad83aa 100644 --- a/sysmodules/loader/source/main.c +++ b/sysmodules/loader/source/main.c @@ -128,7 +128,7 @@ static const ServiceManagerNotificationEntry notifications[] = { { 0x000, NULL }, }; -static u8 ALIGN(4) staticBufferForHbldr[0x400]; +static u8 CTR_ALIGN(4) staticBufferForHbldr[0x400]; static_assert(ARGVBUF_SIZE > 2 * PATH_MAX, "Wrong 3DSX argv buffer size"); int main(void) diff --git a/sysmodules/pm/source/main.c b/sysmodules/pm/source/main.c index 78f4914..e3a94f0 100644 --- a/sysmodules/pm/source/main.c +++ b/sysmodules/pm/source/main.c @@ -16,9 +16,9 @@ #include "luma.h" static MyThread processMonitorThread, taskRunnerThread; -static u8 ALIGN(8) processDataBuffer[0x40 * sizeof(ProcessData)] = {0}; -static u8 ALIGN(8) exheaderInfoBuffer[6 * sizeof(ExHeader_Info)] = {0}; -static u8 ALIGN(8) threadStacks[2][THREAD_STACK_SIZE] = {0}; +static u8 CTR_ALIGN(8) processDataBuffer[0x40 * sizeof(ProcessData)] = {0}; +static u8 CTR_ALIGN(8) exheaderInfoBuffer[6 * sizeof(ExHeader_Info)] = {0}; +static u8 CTR_ALIGN(8) threadStacks[2][THREAD_STACK_SIZE] = {0}; // this is called after main exits void __wrap_exit(int rc) diff --git a/sysmodules/pxi/source/common.h b/sysmodules/pxi/source/common.h index d536f72..7f51836 100644 --- a/sysmodules/pxi/source/common.h +++ b/sysmodules/pxi/source/common.h @@ -44,7 +44,7 @@ typedef struct SessionManager } SessionManager; //Page alignment is mandatory there -extern u32 ALIGN(0x1000) staticBuffers[NB_STATIC_BUFFERS][0x1000/4]; +extern u32 CTR_ALIGN(0x1000) staticBuffers[NB_STATIC_BUFFERS][0x1000/4]; extern Handle PXISyncInterrupt, PXITransferMutex; extern Handle terminationRequestedEvent; diff --git a/sysmodules/pxi/source/main.c b/sysmodules/pxi/source/main.c index 7a9141b..2ebab65 100644 --- a/sysmodules/pxi/source/main.c +++ b/sysmodules/pxi/source/main.c @@ -38,7 +38,7 @@ const char *serviceNames[10] = const u32 nbStaticBuffersByService[10] = {0, 2, 2, 2, 2, 1, 4, 4, 4, 0}; -u32 ALIGN(0x1000) staticBuffers[NB_STATIC_BUFFERS][0x400] = {{0}}; +u32 CTR_ALIGN(0x1000) staticBuffers[NB_STATIC_BUFFERS][0x400] = {{0}}; static inline void initPXI(void) { @@ -95,9 +95,9 @@ static inline void exitPXI(void) PXIReset(); } -static u8 ALIGN(8) receiverStack[THREAD_STACK_SIZE]; -static u8 ALIGN(8) senderStack[THREAD_STACK_SIZE]; -static u8 ALIGN(8) PXISRV11HandlerStack[THREAD_STACK_SIZE]; +static u8 CTR_ALIGN(8) receiverStack[THREAD_STACK_SIZE]; +static u8 CTR_ALIGN(8) senderStack[THREAD_STACK_SIZE]; +static u8 CTR_ALIGN(8) PXISRV11HandlerStack[THREAD_STACK_SIZE]; static MyThread receiverThread = {0}, senderThread = {0}, PXISRV11HandlerThread = {0}; Result __sync_init(void); diff --git a/sysmodules/rosalina/include/plugin/3gx.h b/sysmodules/rosalina/include/plugin/3gx.h index 4b087cb..570bc22 100644 --- a/sysmodules/rosalina/include/plugin/3gx.h +++ b/sysmodules/rosalina/include/plugin/3gx.h @@ -4,7 +4,7 @@ #define _3GX_MAGIC (0x3230303024584733) /* "3GX$0002" */ -typedef struct PACKED +typedef struct CTR_PACKED { u32 authorLen; const char* authorMsg; @@ -28,20 +28,20 @@ typedef struct PACKED u32 builtInSwapSaveLoadArgs[4]; } _3gx_Infos; -typedef struct PACKED +typedef struct CTR_PACKED { u32 count; u32 * titles; } _3gx_Targets; -typedef struct PACKED +typedef struct CTR_PACKED { u32 nbSymbols; u32 symbolsOffset; u32 nameTableOffset; } _3gx_Symtable; -typedef struct PACKED +typedef struct CTR_PACKED { u32 codeOffset; u32 rodataOffset; @@ -55,7 +55,7 @@ typedef struct PACKED u32 swapLoadFuncOffset; // NOP terminated } _3gx_Executable; -typedef struct PACKED +typedef struct CTR_PACKED { u64 magic; u32 version; diff --git a/sysmodules/rosalina/source/bootdiag.c b/sysmodules/rosalina/source/bootdiag.c index b6fe02d..2fd3c9a 100644 --- a/sysmodules/rosalina/source/bootdiag.c +++ b/sysmodules/rosalina/source/bootdiag.c @@ -33,7 +33,7 @@ #ifdef BOOTDIAG_ENABLED static MyThread bootdiagThread; -static u8 ALIGN(0x1000) bootdiagThreadStack[0x1000]; +static u8 CTR_ALIGN(0x1000) bootdiagThreadStack[0x1000]; #define BOOTDIAG_WAIT_TIME (3500 * 1000 * 1000u) // 2 seconds #define BOOTDIAG_DUMP_PLIST 1 diff --git a/sysmodules/rosalina/source/errdisp.c b/sysmodules/rosalina/source/errdisp.c index c1e2294..e18993d 100644 --- a/sysmodules/rosalina/source/errdisp.c +++ b/sysmodules/rosalina/source/errdisp.c @@ -35,7 +35,7 @@ extern Handle preTerminationEvent; static MyThread errDispThread; -static u8 ALIGN(8) errDispThreadStack[0xD00]; +static u8 CTR_ALIGN(8) errDispThreadStack[0xD00]; static char userString[0x100 + 1] = {0}; static char staticBuf[sizeof(userString)] = {0}; diff --git a/sysmodules/rosalina/source/gdb/tio.c b/sysmodules/rosalina/source/gdb/tio.c index 358b103..04df377 100644 --- a/sysmodules/rosalina/source/gdb/tio.c +++ b/sysmodules/rosalina/source/gdb/tio.c @@ -85,7 +85,7 @@ typedef u32 gdbhio_time_t; typedef int gdbhio_mode_t; -struct PACKED ALIGN(4) gdbhio_stat { +struct CTR_PACKED CTR_ALIGN(4) gdbhio_stat { u32 gst_dev; /* device */ u32 gst_ino; /* inode */ gdbhio_mode_t gst_mode; /* protection */ diff --git a/sysmodules/rosalina/source/input_redirection.c b/sysmodules/rosalina/source/input_redirection.c index 0253021..50037d1 100644 --- a/sysmodules/rosalina/source/input_redirection.c +++ b/sysmodules/rosalina/source/input_redirection.c @@ -39,7 +39,7 @@ bool inputRedirectionEnabled = false; Handle inputRedirectionThreadStartedEvent; static MyThread inputRedirectionThread; -static u8 ALIGN(8) inputRedirectionThreadStack[0x4000]; +static u8 CTR_ALIGN(8) inputRedirectionThreadStack[0x4000]; MyThread *inputRedirectionCreateThread(void) { diff --git a/sysmodules/rosalina/source/menu.c b/sysmodules/rosalina/source/menu.c index cec872e..99fe214 100644 --- a/sysmodules/rosalina/source/menu.c +++ b/sysmodules/rosalina/source/menu.c @@ -174,7 +174,7 @@ u32 waitCombo(void) } static MyThread menuThread; -static u8 ALIGN(8) menuThreadStack[0x3000]; +static u8 CTR_ALIGN(8) menuThreadStack[0x3000]; static float batteryPercentage; static float batteryVoltage; diff --git a/sysmodules/rosalina/source/menus/debugger.c b/sysmodules/rosalina/source/menus/debugger.c index 7d3eda1..de5cd44 100644 --- a/sysmodules/rosalina/source/menus/debugger.c +++ b/sysmodules/rosalina/source/menus/debugger.c @@ -48,8 +48,8 @@ Menu debuggerMenu = { static MyThread debuggerSocketThread; static MyThread debuggerDebugThread; -static u8 ALIGN(8) debuggerSocketThreadStack[0x5000]; -static u8 ALIGN(8) debuggerDebugThreadStack[0x3000]; +static u8 CTR_ALIGN(8) debuggerSocketThreadStack[0x5000]; +static u8 CTR_ALIGN(8) debuggerDebugThreadStack[0x3000]; GDBServer gdbServer = { 0 }; diff --git a/sysmodules/rosalina/source/task_runner.c b/sysmodules/rosalina/source/task_runner.c index 3e320cc..8c5f7a8 100644 --- a/sysmodules/rosalina/source/task_runner.c +++ b/sysmodules/rosalina/source/task_runner.c @@ -5,7 +5,7 @@ TaskRunner g_taskRunner; static MyThread taskRunnerThread; -static u8 ALIGN(8) taskRunnerThreadStack[0x1000]; +static u8 CTR_ALIGN(8) taskRunnerThreadStack[0x1000]; static void taskRunnerNoOpFunction(void *args) { diff --git a/sysmodules/sm/source/main.c b/sysmodules/sm/source/main.c index a1abac8..cff44f2 100644 --- a/sysmodules/sm/source/main.c +++ b/sysmodules/sm/source/main.c @@ -22,7 +22,7 @@ SessionDataList sessionDataWaitingPortReadyList = {NULL, NULL}; static SessionData sessionDataPool[76]; static ProcessData processDataPool[64]; -static u8 ALIGN(4) serviceAccessListStaticBuffer[0x110]; +static u8 CTR_ALIGN(4) serviceAccessListStaticBuffer[0x110]; void __ctru_exit(int rc) { (void)rc; } // needed to avoid linking error