Fix macro change in libctru

This commit is contained in:
PabloMK7 2023-10-31 18:38:40 +01:00
parent 3b64e25402
commit e2778a45cf
18 changed files with 54 additions and 54 deletions

View File

@ -53,7 +53,7 @@ struct KMutexLinkedList;
struct KPreemptionTimer; struct KPreemptionTimer;
/* 12 */ /* 12 */
typedef struct ALIGN(4) KAutoObject typedef struct CTR_ALIGN(4) KAutoObject
{ {
struct Vtable__KAutoObject *vtable; struct Vtable__KAutoObject *vtable;
u32 refCount; u32 refCount;
@ -96,7 +96,7 @@ typedef struct KMutexLinkedListNode
} KMutexLinkedListNode; } KMutexLinkedListNode;
/* 1 */ /* 1 */
typedef struct ALIGN(4) KMutex typedef struct CTR_ALIGN(4) KMutex
{ {
KSynchronizationObject syncObject; KSynchronizationObject syncObject;
KMutexLinkedListNode mutexListNode; KMutexLinkedListNode mutexListNode;
@ -153,7 +153,7 @@ typedef struct KClassToken
} KClassToken; } KClassToken;
/* 44 */ /* 44 */
typedef struct ALIGN(4) Vtable__KAutoObject typedef struct CTR_ALIGN(4) Vtable__KAutoObject
{ {
void *field_0; void *field_0;
void *field_4; void *field_4;
@ -174,7 +174,7 @@ typedef struct KBaseInterruptEvent
} KBaseInterruptEvent; } KBaseInterruptEvent;
/* 55 */ /* 55 */
typedef struct ALIGN(4) Vtable__KBaseInterruptEvent typedef struct CTR_ALIGN(4) Vtable__KBaseInterruptEvent
{ {
struct KSchedulableInterruptEvent *(*handleInterruptEvent)(KBaseInterruptEvent *, u32); struct KSchedulableInterruptEvent *(*handleInterruptEvent)(KBaseInterruptEvent *, u32);
} Vtable__KBaseInterruptEvent; } Vtable__KBaseInterruptEvent;
@ -210,7 +210,7 @@ typedef struct KThreadLinkedListNode
/* 93 */ /* 93 */
typedef struct ALIGN(4) KPreemptionTimer typedef struct CTR_ALIGN(4) KPreemptionTimer
{ {
u32 nLimitedTicks; u32 nLimitedTicks;
u32 timer; u32 timer;
@ -219,7 +219,7 @@ typedef struct ALIGN(4) KPreemptionTimer
} KPreemptionTimer; } KPreemptionTimer;
/* 15 */ /* 15 */
typedef struct PACKED ALIGN(4) KThread typedef struct CTR_PACKED CTR_ALIGN(4) KThread
{ {
KSynchronizationObject syncObject; KSynchronizationObject syncObject;
KTimeableInterruptEvent timeableInterruptEvent; KTimeableInterruptEvent timeableInterruptEvent;
@ -277,7 +277,7 @@ typedef enum ProcessStatus
} ProcessStatus; } ProcessStatus;
/* 3 */ /* 3 */
typedef struct ALIGN(4) HandleDescriptor typedef struct CTR_ALIGN(4) HandleDescriptor
{ {
u32 info; u32 info;
KAutoObject *pointer; KAutoObject *pointer;
@ -297,7 +297,7 @@ typedef struct KProcessHandleTable
} KProcessHandleTable; } KProcessHandleTable;
/* 4 */ /* 4 */
typedef struct ALIGN(4) KDebugThread typedef struct CTR_ALIGN(4) KDebugThread
{ {
KThread *linkedThread; KThread *linkedThread;
bool usedSvcBreak; bool usedSvcBreak;
@ -355,7 +355,7 @@ typedef enum {
} ExceptionEventType; } ExceptionEventType;
/* 6 */ /* 6 */
typedef struct ALIGN(4) KDebug typedef struct CTR_ALIGN(4) KDebug
{ {
KSynchronizationObject syncObject; KSynchronizationObject syncObject;
KSendableInterruptEvent sendableInterruptEvent; KSendableInterruptEvent sendableInterruptEvent;
@ -422,7 +422,7 @@ typedef struct KCodeSetMemDescriptor
} KCodeSetMemDescriptor; } KCodeSetMemDescriptor;
/* 5 */ /* 5 */
typedef struct PACKED ALIGN(4) KCodeSet typedef struct CTR_PACKED CTR_ALIGN(4) KCodeSet
{ {
KAutoObject autoObject; KAutoObject autoObject;
KCodeSetMemDescriptor textSection; KCodeSetMemDescriptor textSection;
@ -497,7 +497,7 @@ typedef struct KUserBindableInterruptEvent
} KUserBindableInterruptEvent; } KUserBindableInterruptEvent;
/* 14 */ /* 14 */
typedef struct ALIGN(4) KEvent typedef struct CTR_ALIGN(4) KEvent
{ {
KSynchronizationObject syncObject; KSynchronizationObject syncObject;
KUserBindableInterruptEvent userBindableInterruptEvent; KUserBindableInterruptEvent userBindableInterruptEvent;
@ -601,7 +601,7 @@ typedef struct KMemoryBlock
} KMemoryBlock; } KMemoryBlock;
/* 28 */ /* 28 */
typedef struct ALIGN(4) KScheduler typedef struct CTR_ALIGN(4) KScheduler
{ {
KSchedulableInterruptEvent interruptEvent; KSchedulableInterruptEvent interruptEvent;
u32 threadSwitchAttempts; u32 threadSwitchAttempts;
@ -619,7 +619,7 @@ typedef struct ALIGN(4) KScheduler
} KScheduler; } KScheduler;
/* 46 */ /* 46 */
typedef struct PACKED CodeSetInfo typedef struct CTR_PACKED CodeSetInfo
{ {
char name[8]; char name[8];
u16 unknown_1; u16 unknown_1;
@ -639,7 +639,7 @@ typedef struct PACKED CodeSetInfo
} CodeSetInfo; } CodeSetInfo;
/* 53 */ /* 53 */
typedef struct ALIGN(4) InterruptData typedef struct CTR_ALIGN(4) InterruptData
{ {
KBaseInterruptEvent *interruptEvent; KBaseInterruptEvent *interruptEvent;
bool disableUponReceipt; bool disableUponReceipt;
@ -740,7 +740,7 @@ typedef enum ResetType
} ResetType; } ResetType;
/* 81 */ /* 81 */
typedef struct PACKED ALIGN(4) KTimer typedef struct CTR_PACKED CTR_ALIGN(4) KTimer
{ {
KSynchronizationObject syncObject; KSynchronizationObject syncObject;
KTimeableInterruptEvent timeableInterruptEvent; KTimeableInterruptEvent timeableInterruptEvent;
@ -768,7 +768,7 @@ typedef KSchedulableInterruptEvent KThreadTerminationInterruptEvent;
typedef KSchedulableInterruptEvent KThreadExitInterruptEvent; typedef KSchedulableInterruptEvent KThreadExitInterruptEvent;
/* 89 */ /* 89 */
typedef struct ALIGN(4) KInterruptEventMailbox typedef struct CTR_ALIGN(4) KInterruptEventMailbox
{ {
u32 mailboxID; u32 mailboxID;
KSendableInterruptEvent *first; KSendableInterruptEvent *first;
@ -795,7 +795,7 @@ typedef enum LimitableResource
} LimitableResource; } LimitableResource;
/* 99 */ /* 99 */
typedef struct ALIGN(4) CpuRegisters typedef struct CTR_ALIGN(4) CpuRegisters
{ {
u32 r[13]; u32 r[13];
u32 sp; u32 sp;
@ -809,7 +809,7 @@ typedef struct FpuRegisters
{ {
union union
{ {
struct PACKED { double d[16]; }; struct CTR_PACKED { double d[16]; };
float s[32]; float s[32];
}; };
u32 fpscr; u32 fpscr;
@ -974,7 +974,7 @@ typedef struct KEventInfo
}; };
} KEventInfo; } KEventInfo;
typedef struct ALIGN(0x1000) KCoreObjectContext typedef struct CTR_ALIGN(0x1000) KCoreObjectContext
{ {
KThread *volatile currentThread; KThread *volatile currentThread;
union KProcess *volatile currentProcess; union KProcess *volatile currentProcess;
@ -1004,7 +1004,7 @@ extern KCoreContext *coreCtxs;
#define DEFINE_CONSOLE_SPECIFIC_STRUCTS(console, nbCores) #define DEFINE_CONSOLE_SPECIFIC_STRUCTS(console, nbCores)
/* 60 */ /* 60 */
typedef struct ALIGN(4) KProcessHwInfoN3DS typedef struct CTR_ALIGN(4) KProcessHwInfoN3DS
{ {
KObjectMutex mutex; KObjectMutex mutex;
u32 processTLBEntriesNeedToBeFlushedOnCore[4]; u32 processTLBEntriesNeedToBeFlushedOnCore[4];
@ -1023,7 +1023,7 @@ typedef struct ALIGN(4) KProcessHwInfoN3DS
u32 *mmuTableVA; u32 *mmuTableVA;
} KProcessHwInfoN3DS; } KProcessHwInfoN3DS;
typedef struct ALIGN(4) KProcessHwInfoO3DS8x typedef struct CTR_ALIGN(4) KProcessHwInfoO3DS8x
{ {
KObjectMutex mutex; KObjectMutex mutex;
u32 processTLBEntriesNeedToBeFlushedOnCore[2]; u32 processTLBEntriesNeedToBeFlushedOnCore[2];
@ -1042,7 +1042,7 @@ typedef struct ALIGN(4) KProcessHwInfoO3DS8x
u32 *mmuTableVA; u32 *mmuTableVA;
} KProcessHwInfoO3DS8x; } KProcessHwInfoO3DS8x;
typedef struct ALIGN(4) KProcessHwInfoO3DSPre8x typedef struct CTR_ALIGN(4) KProcessHwInfoO3DSPre8x
{ {
KObjectMutex mutex; KObjectMutex mutex;
u32 processTLBEntriesNeedToBeFlushedOnCore[2]; u32 processTLBEntriesNeedToBeFlushedOnCore[2];

View File

@ -69,11 +69,11 @@ typedef s32 Result; ///< Function result.
#define BIT(n) (1U<<(n)) #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. /// 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. /// Packs a struct (and other types?) so it won't include padding bytes.
#define PACKED __attribute__((packed)) #define CTR_PACKED __attribute__((packed))
#define USED __attribute__((used)) #define CTR_USED __attribute__((used))
#define UNUSED __attribute__((unused)) #define CTR_UNUSED __attribute__((unused))
/// Packs a system version from its components. /// Packs a system version from its components.
#define SYSTEM_VERSION(major, minor, revision) \ #define SYSTEM_VERSION(major, minor, revision) \
(((major)<<24)|((minor)<<16)|((revision)<<8)) (((major)<<24)|((minor)<<16)|((revision)<<8))

View File

@ -31,7 +31,7 @@
KRecursiveLock dbgParamsLock = { NULL }; KRecursiveLock dbgParamsLock = { NULL };
u32 dbgParamWatchpointId, dbgParamDVA, dbgParamWCR, dbgParamContextId; u32 dbgParamWatchpointId, dbgParamDVA, dbgParamWCR, dbgParamContextId;
KSchedulableInterruptEvent *enableMonitorModeDebugging(KBaseInterruptEvent *this UNUSED, u32 interruptID UNUSED) KSchedulableInterruptEvent *enableMonitorModeDebugging(KBaseInterruptEvent *this CTR_UNUSED, u32 interruptID CTR_UNUSED)
{ {
coreBarrier(); coreBarrier();
@ -76,7 +76,7 @@ static void disableWatchpoint1(void)
__asm__ __volatile__("mcr p14, 0, %[val], c0, c5, 5" :: [val] "r" (control)); __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(); 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 __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(); coreBarrier();

View File

@ -46,7 +46,7 @@ struct KExtParameters
CfwInfo cfwInfo; CfwInfo cfwInfo;
} kExtParameters = { .basePA = 0x12345678 }; // place this in .data } 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) void relocateAndSetupMMU(u32 coreId, u32 *L1Table)
{ {

View File

@ -26,7 +26,7 @@
#include "svc/SetGpuProt.h" #include "svc/SetGpuProt.h"
Result SetGpuProt(bool prot UNUSED) Result SetGpuProt(bool prot CTR_UNUSED)
{ {
return 0; return 0;
} }

View File

@ -128,7 +128,7 @@ static const ServiceManagerNotificationEntry notifications[] = {
{ 0x000, NULL }, { 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"); static_assert(ARGVBUF_SIZE > 2 * PATH_MAX, "Wrong 3DSX argv buffer size");
int main(void) int main(void)

View File

@ -16,9 +16,9 @@
#include "luma.h" #include "luma.h"
static MyThread processMonitorThread, taskRunnerThread; static MyThread processMonitorThread, taskRunnerThread;
static u8 ALIGN(8) processDataBuffer[0x40 * sizeof(ProcessData)] = {0}; static u8 CTR_ALIGN(8) processDataBuffer[0x40 * sizeof(ProcessData)] = {0};
static u8 ALIGN(8) exheaderInfoBuffer[6 * sizeof(ExHeader_Info)] = {0}; static u8 CTR_ALIGN(8) exheaderInfoBuffer[6 * sizeof(ExHeader_Info)] = {0};
static u8 ALIGN(8) threadStacks[2][THREAD_STACK_SIZE] = {0}; static u8 CTR_ALIGN(8) threadStacks[2][THREAD_STACK_SIZE] = {0};
// this is called after main exits // this is called after main exits
void __wrap_exit(int rc) void __wrap_exit(int rc)

View File

@ -44,7 +44,7 @@ typedef struct SessionManager
} SessionManager; } SessionManager;
//Page alignment is mandatory there //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 PXISyncInterrupt, PXITransferMutex;
extern Handle terminationRequestedEvent; extern Handle terminationRequestedEvent;

View File

@ -38,7 +38,7 @@ const char *serviceNames[10] =
const u32 nbStaticBuffersByService[10] = {0, 2, 2, 2, 2, 1, 4, 4, 4, 0}; 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) static inline void initPXI(void)
{ {
@ -95,9 +95,9 @@ static inline void exitPXI(void)
PXIReset(); PXIReset();
} }
static u8 ALIGN(8) receiverStack[THREAD_STACK_SIZE]; static u8 CTR_ALIGN(8) receiverStack[THREAD_STACK_SIZE];
static u8 ALIGN(8) senderStack[THREAD_STACK_SIZE]; static u8 CTR_ALIGN(8) senderStack[THREAD_STACK_SIZE];
static u8 ALIGN(8) PXISRV11HandlerStack[THREAD_STACK_SIZE]; static u8 CTR_ALIGN(8) PXISRV11HandlerStack[THREAD_STACK_SIZE];
static MyThread receiverThread = {0}, senderThread = {0}, PXISRV11HandlerThread = {0}; static MyThread receiverThread = {0}, senderThread = {0}, PXISRV11HandlerThread = {0};
Result __sync_init(void); Result __sync_init(void);

View File

@ -4,7 +4,7 @@
#define _3GX_MAGIC (0x3230303024584733) /* "3GX$0002" */ #define _3GX_MAGIC (0x3230303024584733) /* "3GX$0002" */
typedef struct PACKED typedef struct CTR_PACKED
{ {
u32 authorLen; u32 authorLen;
const char* authorMsg; const char* authorMsg;
@ -28,20 +28,20 @@ typedef struct PACKED
u32 builtInSwapSaveLoadArgs[4]; u32 builtInSwapSaveLoadArgs[4];
} _3gx_Infos; } _3gx_Infos;
typedef struct PACKED typedef struct CTR_PACKED
{ {
u32 count; u32 count;
u32 * titles; u32 * titles;
} _3gx_Targets; } _3gx_Targets;
typedef struct PACKED typedef struct CTR_PACKED
{ {
u32 nbSymbols; u32 nbSymbols;
u32 symbolsOffset; u32 symbolsOffset;
u32 nameTableOffset; u32 nameTableOffset;
} _3gx_Symtable; } _3gx_Symtable;
typedef struct PACKED typedef struct CTR_PACKED
{ {
u32 codeOffset; u32 codeOffset;
u32 rodataOffset; u32 rodataOffset;
@ -55,7 +55,7 @@ typedef struct PACKED
u32 swapLoadFuncOffset; // NOP terminated u32 swapLoadFuncOffset; // NOP terminated
} _3gx_Executable; } _3gx_Executable;
typedef struct PACKED typedef struct CTR_PACKED
{ {
u64 magic; u64 magic;
u32 version; u32 version;

View File

@ -33,7 +33,7 @@
#ifdef BOOTDIAG_ENABLED #ifdef BOOTDIAG_ENABLED
static MyThread bootdiagThread; 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_WAIT_TIME (3500 * 1000 * 1000u) // 2 seconds
#define BOOTDIAG_DUMP_PLIST 1 #define BOOTDIAG_DUMP_PLIST 1

View File

@ -35,7 +35,7 @@
extern Handle preTerminationEvent; extern Handle preTerminationEvent;
static MyThread errDispThread; static MyThread errDispThread;
static u8 ALIGN(8) errDispThreadStack[0xD00]; static u8 CTR_ALIGN(8) errDispThreadStack[0xD00];
static char userString[0x100 + 1] = {0}; static char userString[0x100 + 1] = {0};
static char staticBuf[sizeof(userString)] = {0}; static char staticBuf[sizeof(userString)] = {0};

View File

@ -85,7 +85,7 @@
typedef u32 gdbhio_time_t; typedef u32 gdbhio_time_t;
typedef int gdbhio_mode_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_dev; /* device */
u32 gst_ino; /* inode */ u32 gst_ino; /* inode */
gdbhio_mode_t gst_mode; /* protection */ gdbhio_mode_t gst_mode; /* protection */

View File

@ -39,7 +39,7 @@ bool inputRedirectionEnabled = false;
Handle inputRedirectionThreadStartedEvent; Handle inputRedirectionThreadStartedEvent;
static MyThread inputRedirectionThread; static MyThread inputRedirectionThread;
static u8 ALIGN(8) inputRedirectionThreadStack[0x4000]; static u8 CTR_ALIGN(8) inputRedirectionThreadStack[0x4000];
MyThread *inputRedirectionCreateThread(void) MyThread *inputRedirectionCreateThread(void)
{ {

View File

@ -174,7 +174,7 @@ u32 waitCombo(void)
} }
static MyThread menuThread; static MyThread menuThread;
static u8 ALIGN(8) menuThreadStack[0x3000]; static u8 CTR_ALIGN(8) menuThreadStack[0x3000];
static float batteryPercentage; static float batteryPercentage;
static float batteryVoltage; static float batteryVoltage;

View File

@ -48,8 +48,8 @@ Menu debuggerMenu = {
static MyThread debuggerSocketThread; static MyThread debuggerSocketThread;
static MyThread debuggerDebugThread; static MyThread debuggerDebugThread;
static u8 ALIGN(8) debuggerSocketThreadStack[0x5000]; static u8 CTR_ALIGN(8) debuggerSocketThreadStack[0x5000];
static u8 ALIGN(8) debuggerDebugThreadStack[0x3000]; static u8 CTR_ALIGN(8) debuggerDebugThreadStack[0x3000];
GDBServer gdbServer = { 0 }; GDBServer gdbServer = { 0 };

View File

@ -5,7 +5,7 @@
TaskRunner g_taskRunner; TaskRunner g_taskRunner;
static MyThread taskRunnerThread; static MyThread taskRunnerThread;
static u8 ALIGN(8) taskRunnerThreadStack[0x1000]; static u8 CTR_ALIGN(8) taskRunnerThreadStack[0x1000];
static void taskRunnerNoOpFunction(void *args) static void taskRunnerNoOpFunction(void *args)
{ {

View File

@ -22,7 +22,7 @@ SessionDataList sessionDataWaitingPortReadyList = {NULL, NULL};
static SessionData sessionDataPool[76]; static SessionData sessionDataPool[76];
static ProcessData processDataPool[64]; 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 void __ctru_exit(int rc) { (void)rc; } // needed to avoid linking error