Skip to content

Commit

Permalink
Fix macro change in libctru
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloMK7 committed Oct 31, 2023
1 parent 3b64e25 commit e2778a4
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 54 deletions.
44 changes: 22 additions & 22 deletions k11_extension/include/kernel.h
Expand Up @@ -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;
Expand Down Expand Up @@ -96,7 +96,7 @@ typedef struct KMutexLinkedListNode
} KMutexLinkedListNode;

/* 1 */
typedef struct ALIGN(4) KMutex
typedef struct CTR_ALIGN(4) KMutex
{
KSynchronizationObject syncObject;
KMutexLinkedListNode mutexListNode;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -210,7 +210,7 @@ typedef struct KThreadLinkedListNode


/* 93 */
typedef struct ALIGN(4) KPreemptionTimer
typedef struct CTR_ALIGN(4) KPreemptionTimer
{
u32 nLimitedTicks;
u32 timer;
Expand All @@ -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;
Expand Down Expand Up @@ -277,7 +277,7 @@ typedef enum ProcessStatus
} ProcessStatus;

/* 3 */
typedef struct ALIGN(4) HandleDescriptor
typedef struct CTR_ALIGN(4) HandleDescriptor
{
u32 info;
KAutoObject *pointer;
Expand All @@ -297,7 +297,7 @@ typedef struct KProcessHandleTable
} KProcessHandleTable;

/* 4 */
typedef struct ALIGN(4) KDebugThread
typedef struct CTR_ALIGN(4) KDebugThread
{
KThread *linkedThread;
bool usedSvcBreak;
Expand Down Expand Up @@ -355,7 +355,7 @@ typedef enum {
} ExceptionEventType;

/* 6 */
typedef struct ALIGN(4) KDebug
typedef struct CTR_ALIGN(4) KDebug
{
KSynchronizationObject syncObject;
KSendableInterruptEvent sendableInterruptEvent;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -497,7 +497,7 @@ typedef struct KUserBindableInterruptEvent
} KUserBindableInterruptEvent;

/* 14 */
typedef struct ALIGN(4) KEvent
typedef struct CTR_ALIGN(4) KEvent
{
KSynchronizationObject syncObject;
KUserBindableInterruptEvent userBindableInterruptEvent;
Expand Down Expand Up @@ -601,7 +601,7 @@ typedef struct KMemoryBlock
} KMemoryBlock;

/* 28 */
typedef struct ALIGN(4) KScheduler
typedef struct CTR_ALIGN(4) KScheduler
{
KSchedulableInterruptEvent interruptEvent;
u32 threadSwitchAttempts;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -809,7 +809,7 @@ typedef struct FpuRegisters
{
union
{
struct PACKED { double d[16]; };
struct CTR_PACKED { double d[16]; };
float s[32];
};
u32 fpscr;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand All @@ -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];
Expand All @@ -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];
Expand Down
8 changes: 4 additions & 4 deletions k11_extension/include/types.h
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions k11_extension/source/debug.c
Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion k11_extension/source/main.c
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion k11_extension/source/svc/SetGpuProt.c
Expand Up @@ -26,7 +26,7 @@

#include "svc/SetGpuProt.h"

Result SetGpuProt(bool prot UNUSED)
Result SetGpuProt(bool prot CTR_UNUSED)
{
return 0;
}
2 changes: 1 addition & 1 deletion sysmodules/loader/source/main.c
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions sysmodules/pm/source/main.c
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sysmodules/pxi/source/common.h
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions sysmodules/pxi/source/main.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions sysmodules/rosalina/include/plugin/3gx.h
Expand Up @@ -4,7 +4,7 @@

#define _3GX_MAGIC (0x3230303024584733) /* "3GX$0002" */

typedef struct PACKED
typedef struct CTR_PACKED
{
u32 authorLen;
const char* authorMsg;
Expand All @@ -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;
Expand All @@ -55,7 +55,7 @@ typedef struct PACKED
u32 swapLoadFuncOffset; // NOP terminated
} _3gx_Executable;

typedef struct PACKED
typedef struct CTR_PACKED
{
u64 magic;
u32 version;
Expand Down
2 changes: 1 addition & 1 deletion sysmodules/rosalina/source/bootdiag.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sysmodules/rosalina/source/errdisp.c
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion sysmodules/rosalina/source/gdb/tio.c
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion sysmodules/rosalina/source/input_redirection.c
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion sysmodules/rosalina/source/menu.c
Expand Up @@ -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;
Expand Down

0 comments on commit e2778a4

Please sign in to comment.