Add ASM define to wrap mwerks asm keyword

This commit is contained in:
LagoLunatic
2024-12-28 15:45:24 -05:00
parent f18e2b10dd
commit f543b7b471
15 changed files with 83 additions and 78 deletions
+2
View File
@@ -33,11 +33,13 @@
#define ALIGN_DECL(ALIGNMENT) __attribute__((aligned(ALIGNMENT)))
#define SECTION_DATA __declspec(section ".data")
#define SECTION_INIT __declspec(section ".init")
#define ASM asm
#else
#define STATIC_ASSERT(...)
#define ALIGN_DECL(...)
#define SECTION_DATA
#define SECTION_INIT
#define ASM
#endif
extern int __cntlzw(uint);
@@ -1,5 +1,6 @@
#include "NMWException.h"
#include "__ppc_eabi_linker.h"
#include "global.h"
#if __MWERKS__
#pragma exceptions off
@@ -20,7 +21,7 @@ extern void __fini_cpp_exceptions(void);
static int fragmentID = -2;
/* clang-format off */
static asm char* GetR2() {
static ASM char* GetR2() {
nofralloc;
mr r3, r2
blr
+4 -3
View File
@@ -1,8 +1,9 @@
#include "ptmf.h"
#include "global.h"
const __ptmf __ptmf_null = { 0, 0, 0 };
asm long __ptmf_test(register __ptmf* ptmf) {
ASM long __ptmf_test(register __ptmf* ptmf) {
lwz r5, __ptmf.this_delta(ptmf)
lwz r6, __ptmf.v_offset(ptmf)
lwz r7, __ptmf.f_data(ptmf)
@@ -17,7 +18,7 @@ asm long __ptmf_test(register __ptmf* ptmf) {
blr
};
asm void __ptmf_cmpr(register __ptmf* lhs, register __ptmf* rhs) {
ASM void __ptmf_cmpr(register __ptmf* lhs, register __ptmf* rhs) {
lwz r5, __ptmf.this_delta(lhs)
lwz r6, __ptmf.this_delta(rhs)
lwz r7, __ptmf.v_offset(lhs)
@@ -35,7 +36,7 @@ asm void __ptmf_cmpr(register __ptmf* lhs, register __ptmf* rhs) {
blr
};
asm void __ptmf_scall(...) {
ASM void __ptmf_scall(...) {
nofralloc;
lwz r0, __ptmf.this_delta(r12)
lwz r11, __ptmf.v_offset(r12)
+23 -22
View File
@@ -1,4 +1,5 @@
#include "PowerPC_EABI_Support/Runtime/Inc/runtime.h"
#include "global.h"
#ifdef __cplusplus
extern "C" {
@@ -17,14 +18,14 @@ extern "C" {
#define save_restore_reg r11
asm void __div2u(void);
asm void __div2i(void);
asm void __mod2u(void);
asm void __mod2i(void);
asm void __shl2i(void);
asm void __shr2u(void);
asm void __shr2i(void);
asm void __cvt_dbl_usll(void);
ASM void __div2u(void);
ASM void __div2i(void);
ASM void __mod2u(void);
ASM void __mod2i(void);
ASM void __shl2i(void);
ASM void __shr2u(void);
ASM void __shr2i(void);
ASM void __cvt_dbl_usll(void);
void SAVE_FPR(14)(void);
void SAVE_FPR(15)(void);
@@ -110,7 +111,7 @@ static const u32 __constants[] = {
* @note Address: 0x800C1B4C
* @note Size: 0x5C
*/
asm u32 __cvt_fp2unsigned(register f64 d)
ASM u32 __cvt_fp2unsigned(register f64 d)
{
#ifdef __MWERKS__ // clang-format off
nofralloc
@@ -145,7 +146,7 @@ asm u32 __cvt_fp2unsigned(register f64 d)
* @note Address: 0x800C1BA8
* @note Size: 0x4C
*/
asm static void __save_fpr(void) {
ASM static void __save_fpr(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
stfd fp14,-144(save_restore_reg)
@@ -178,7 +179,7 @@ asm static void __save_fpr(void) {
* @note Address: 0x800C1BF4
* @note Size: 0x4C
*/
asm static void __restore_fpr(void) {
ASM static void __restore_fpr(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
lfd fp14,-144(save_restore_reg)
@@ -211,7 +212,7 @@ asm static void __restore_fpr(void) {
* @note Address: 0x800C1C40
* @note Size: 0x4C
*/
asm static void __save_gpr(void) {
ASM static void __save_gpr(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
ENTRY_SAVE_GPR(14)
@@ -256,7 +257,7 @@ asm static void __save_gpr(void) {
* @note Address: 0x800C1C8C
* @note Size: 0x4C
*/
asm static void __restore_gpr(void) {
ASM static void __restore_gpr(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
ENTRY_RESTORE_GPR(14)
@@ -301,7 +302,7 @@ asm static void __restore_gpr(void) {
* @note Address: 0x800C1CD8
* @note Size: 0xEC
*/
asm void __div2u(void) {
ASM void __div2u(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
cmpwi cr0,r3,0
@@ -379,7 +380,7 @@ lab9:
* @note Address: 0x800C1DC4
* @note Size: 0x138
*/
asm void __div2i(void) {
ASM void __div2i(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
stwu r1,-16(r1)
@@ -482,7 +483,7 @@ func_end:
* @note Address: 0x800C1EFC
* @note Size: 0xE4
*/
asm void __mod2u(void) {
ASM void __mod2u(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
cmpwi cr0,r3,0
@@ -558,7 +559,7 @@ lab9:
* @note Address: 0x800C1FE0
* @note Size: 0x10C
*/
asm void __mod2i(void) {
ASM void __mod2i(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
@@ -648,7 +649,7 @@ no_adjust:
* @note Address: 0x800C20EC
* @note Size: 0x24
*/
asm void __shl2i(void) {
ASM void __shl2i(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
subfic r8,r5,32
@@ -667,7 +668,7 @@ asm void __shl2i(void) {
* @note Address: 0x800C2110
* @note Size: 0x24
*/
asm void __shr2u(void) {
ASM void __shr2u(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
subfic r8,r5,32
@@ -686,7 +687,7 @@ asm void __shr2u(void) {
* @note Address: 0x800C2134
* @note Size: 0x28
*/
asm void __shr2i(void) {
ASM void __shr2i(void) {
#ifdef __MWERKS__ // clang-format off
nofralloc
subfic r8, r5, 0x20
@@ -707,7 +708,7 @@ around:
* @note Address: 0x800C21F8
* @note Size: 0xCC
*/
asm void __cvt_dbl_usll(void)
ASM void __cvt_dbl_usll(void)
{
#ifdef __MWERKS__ // clang-format off
nofralloc
@@ -774,4 +775,4 @@ func_end:
#ifdef __cplusplus
}
#endif
#endif
+6 -6
View File
@@ -44,7 +44,7 @@ f64 ZeroPS;
extern f64 ZeroF;
f64 ZeroF;
asm void __OSFPRInit(void) {
ASM void __OSFPRInit(void) {
// clang-format off
nofralloc
@@ -451,7 +451,7 @@ static void OSExceptionInit(void) {
DBPrintf("Exceptions initialized...\n");
}
asm void __OSDBIntegrator(void) {
ASM void __OSDBIntegrator(void) {
// clang-format off
nofralloc
@@ -469,7 +469,7 @@ entry __OSDBINTEND
// clang-format on
}
asm void __OSDBJump(void){
ASM void __OSDBJump(void){
// clang-format off
nofralloc
@@ -489,7 +489,7 @@ OSExceptionHandler __OSGetExceptionHandler(__OSException exception) {
return OSExceptionTable[exception];
}
static asm void OSExceptionVector(void) {
static ASM void OSExceptionVector(void) {
// clang-format off
nofralloc
@@ -573,7 +573,7 @@ entry __OSEVEnd
// clang-format on
}
static asm void OSDefaultExceptionHandler(register __OSException exception,
static ASM void OSDefaultExceptionHandler(register __OSException exception,
register OSContext* context) {
// clang-format off
nofralloc
@@ -605,7 +605,7 @@ static asm void OSDefaultExceptionHandler(register __OSException exception,
// clang-format on
}
asm void __OSPSInit(void){
ASM void __OSPSInit(void){
// clang-format off
nofralloc
+2 -2
View File
@@ -23,7 +23,7 @@ void OSCreateAlarm(OSAlarm* alarm) {
alarm->tag = 0;
}
static inline SetTimer(OSAlarm* alarm) {
static void SetTimer(OSAlarm* alarm) {
OSTime delta;
delta = alarm->fire_time - __OSGetSystemTime();
@@ -177,7 +177,7 @@ static void DecrementerExceptionCallback(register __OSException exception,
OSLoadContext(context);
}
static asm void DecrementerExceptionHandler(register __OSException exception,
static ASM void DecrementerExceptionHandler(register __OSException exception,
register OSContext* context) {
// clang-format off
nofralloc
+14 -14
View File
@@ -3,7 +3,7 @@
#include "dolphin/db/db.h"
#include "dolphin/os/OS.h"
static asm void DCEnable(void) {
static ASM void DCEnable(void) {
// clang-format off
nofralloc
@@ -16,7 +16,7 @@ static asm void DCEnable(void) {
// clang-format on
}
asm void DCInvalidateRange(register void* start, register u32 nBytes) {
ASM void DCInvalidateRange(register void* start, register u32 nBytes) {
// clang-format off
nofralloc
@@ -38,7 +38,7 @@ do_invalidate:
// clang-format on
}
asm void DCFlushRange(register void* start, register u32 nBytes) {
ASM void DCFlushRange(register void* start, register u32 nBytes) {
// clang-format off
nofralloc
@@ -61,7 +61,7 @@ do_flush:
// clang-format on
}
asm void DCStoreRange(register void* start, register u32 nBytes) {
ASM void DCStoreRange(register void* start, register u32 nBytes) {
// clang-format off
nofralloc
@@ -84,7 +84,7 @@ do_store:
// clang-format on
}
asm void DCFlushRangeNoSync(register void* start, register u32 nBytes) {
ASM void DCFlushRangeNoSync(register void* start, register u32 nBytes) {
// clang-format off
nofralloc
@@ -106,7 +106,7 @@ do_flush:
// clang-format on
}
asm void DCStoreRangeNoSync(register void* start, register u32 nBytes) {
ASM void DCStoreRangeNoSync(register void* start, register u32 nBytes) {
// clang-format off
nofralloc
@@ -128,7 +128,7 @@ do_store:
// clang-format on
}
asm void DCZeroRange(register void* start, register u32 nBytes) {
ASM void DCZeroRange(register void* start, register u32 nBytes) {
// clang-format off
nofralloc
@@ -150,7 +150,7 @@ do_zero:
// clang-format on
}
asm void ICInvalidateRange(register void* start, register u32 nBytes) {
ASM void ICInvalidateRange(register void* start, register u32 nBytes) {
// clang-format off
nofralloc
@@ -175,7 +175,7 @@ do_invalidate:
// clang-format on
}
asm void ICFlashInvalidate(void) {
ASM void ICFlashInvalidate(void) {
// clang-format off
nofralloc
@@ -187,7 +187,7 @@ asm void ICFlashInvalidate(void) {
// clang-format on
}
static asm void ICEnable(void) {
static ASM void ICEnable(void) {
// clang-format off
nofralloc
@@ -200,7 +200,7 @@ static asm void ICEnable(void) {
// clang-format on
}
asm void __LCEnable(void) {
ASM void __LCEnable(void) {
// clang-format off
nofralloc
@@ -274,7 +274,7 @@ void LCEnable(void) {
OSRestoreInterrupts(interrupt);
}
asm void LCDisable(void) {
ASM void LCDisable(void) {
// clang-format off
nofralloc
@@ -294,7 +294,7 @@ do_invalidate:
// clang-format on
}
static asm void LCStoreBlocks(register void* destAddr, register void* srcAddr,
static ASM void LCStoreBlocks(register void* destAddr, register void* srcAddr,
register u32 blockNum){
// clang-format off
nofralloc
@@ -331,7 +331,7 @@ u32 LCStoreData(void* destAddr, void* srcAddr, u32 nBytes) {
return ret;
}
asm void LCQueueWait(register u32 len) {
ASM void LCQueueWait(register u32 len) {
// clang-format off
nofralloc
+10 -10
View File
@@ -6,7 +6,7 @@
volatile OSContext* __OSCurrentContext AT_ADDRESS(OS_BASE_CACHED | 0x00D4);
volatile OSContext* __OSFPUContext AT_ADDRESS(OS_BASE_CACHED | 0x00D8);
asm void __OSLoadFPUContext(s32 unused0, register OSContext* context) {
ASM void __OSLoadFPUContext(s32 unused0, register OSContext* context) {
// clang-format off
nofralloc
@@ -92,7 +92,7 @@ exit:
// clang-format on
}
asm void __OSSaveFPUContext(s32 unused0, s32 unused1, register OSContext* context) {
ASM void __OSSaveFPUContext(s32 unused0, s32 unused1, register OSContext* context) {
// clang-format off
nofralloc
@@ -178,7 +178,7 @@ exit:
// clang-format on
}
asm void OSSaveFPUContext(register OSContext* context) {
ASM void OSSaveFPUContext(register OSContext* context) {
// clang-format off
nofralloc
@@ -187,7 +187,7 @@ asm void OSSaveFPUContext(register OSContext* context) {
// clang-format on
}
asm void OSSetCurrentContext(register OSContext* context) {
ASM void OSSetCurrentContext(register OSContext* context) {
// clang-format off
nofralloc
@@ -223,7 +223,7 @@ OSContext* OSGetCurrentContext(void) {
return OS_CURRENT_CONTEXT;
}
asm u32 OSSaveContext(register OSContext* context) {
ASM u32 OSSaveContext(register OSContext* context) {
// clang-format off
nofralloc
@@ -267,7 +267,7 @@ asm u32 OSSaveContext(register OSContext* context) {
// clang-format on
}
asm void OSLoadContext(register OSContext* context) {
ASM void OSLoadContext(register OSContext* context) {
// clang-format off
nofralloc
@@ -334,7 +334,7 @@ load_special_regs:
// clang-format on
}
asm u8* OSGetStackPointer(void) {
ASM u8* OSGetStackPointer(void) {
// clang-format off
nofralloc
@@ -352,7 +352,7 @@ void OSClearContext(OSContext* context) {
}
}
asm void OSInitContext(register OSContext* context, register u32 srr0, register u32 stack) {
ASM void OSInitContext(register OSContext* context, register u32 srr0, register u32 stack) {
// clang-format off
nofralloc
@@ -459,7 +459,7 @@ void OSDumpContext(OSContext* context) {
}
}
static asm void OSSwitchFPUContext(register u8 err, register OSContext* context) {
static ASM void OSSwitchFPUContext(register u8 err, register OSContext* context) {
// clang-format off
nofralloc
@@ -509,7 +509,7 @@ void __OSContextInit(void) {
DBPrintf("FPU-unavailable handler installed\n");
}
asm void OSFillFPUContext(register OSContext* context) {
ASM void OSFillFPUContext(register OSContext* context) {
// clang-format off
nofralloc
+4 -4
View File
@@ -6,7 +6,7 @@
vu32 __PIRegs[12] AT_ADDRESS(0xCC003000);
vu16 __MEMRegs[64] AT_ADDRESS(0xCC004000);
asm BOOL OSDisableInterrupts(void) {
ASM BOOL OSDisableInterrupts(void) {
// clang-format off
nofralloc
@@ -25,7 +25,7 @@ asm BOOL OSDisableInterrupts(void) {
// clang-format on
}
asm BOOL OSEnableInterrupts(void) {
ASM BOOL OSEnableInterrupts(void) {
// clang-format off
nofralloc
@@ -40,7 +40,7 @@ asm BOOL OSEnableInterrupts(void) {
// clang-format on
}
asm BOOL OSRestoreInterrupts(register BOOL status) {
ASM BOOL OSRestoreInterrupts(register BOOL status) {
// clang-format off
nofralloc
@@ -400,7 +400,7 @@ void __OSDispatchInterrupt(__OSException exception, OSContext* context) {
OSLoadContext(context);
}
static asm void ExternalInterruptHandler(register __OSInterrupt type, register OSContext* context) {
static ASM void ExternalInterruptHandler(register __OSInterrupt type, register OSContext* context) {
// clang-format off
nofralloc
+3 -3
View File
@@ -73,7 +73,7 @@ void OSProtectRange(u32 chan, void* addr, u32 nBytes, u32 control) {
OSRestoreInterrupts(enabled);
}
static asm void Config24MB(void) {
static ASM void Config24MB(void) {
// clang-format off
nofralloc
@@ -112,7 +112,7 @@ static asm void Config24MB(void) {
// clang-format on
}
static asm void Config48MB(void) {
static ASM void Config48MB(void) {
// clang-format off
nofralloc
@@ -151,7 +151,7 @@ static asm void Config48MB(void) {
// clang-format on
}
static asm void RealMode(register u32 config) {
static ASM void RealMode(register u32 config) {
// clang-format off
nofralloc
+1 -1
View File
@@ -22,7 +22,7 @@ typedef struct _ApploaderHeader {
static ApploaderHeader Header ALIGN_DECL(32);
asm static void Run(register u32 addr) {
ASM static void Run(register u32 addr) {
nofralloc
sync
+1 -1
View File
@@ -56,7 +56,7 @@ inline BOOL __OSCallResetFunctions(u32 arg0) {
}
#ifdef __MWERKS__
static asm void Reset(register s32 param_0) {
static ASM void Reset(register s32 param_0) {
// clang-format off
nofralloc
+1 -1
View File
@@ -4,7 +4,7 @@
void __OSSystemCallVectorStart();
void __OSSystemCallVectorEnd();
static asm void SystemCallVector(void) {
static ASM void SystemCallVector(void) {
// clang-format off
nofralloc
+6 -6
View File
@@ -5,9 +5,9 @@
#define OS_TIME_WEEK_DAY_MAX 7
#define OS_TIME_YEAR_DAY_MAX 365
#ifdef __MWERKS__
asm OSTime OSGetTime(void) {
ASM OSTime OSGetTime(void) {
// clang-format off
#ifdef __MWERKS__
nofralloc
mftbu r3
@@ -18,20 +18,20 @@ asm OSTime OSGetTime(void) {
bne OSGetTime
blr
#endif
// clang-format on
}
#endif
#ifdef __MWERKS__
asm OSTick OSGetTick(void) {
ASM OSTick OSGetTick(void) {
// clang-format off
#ifdef __MWERKS__
nofralloc
mftb r3, 0x10C
blr
#endif
// clang-format on
}
#endif
#define OS_SYSTEMTIME_BASE 0x30D8
+4 -4
View File
@@ -11,7 +11,7 @@ SECTION_INIT void __check_pad3(void) {
}
}
SECTION_INIT asm void __start(void) {
SECTION_INIT ASM void __start(void) {
// clang-format off
nofralloc
@@ -114,7 +114,7 @@ lbl_8000329C:
// clang-format on
}
asm static void __init_registers(void)
ASM static void __init_registers(void)
{
#ifdef __MWERKS__
nofralloc
@@ -165,7 +165,7 @@ void __init_data(void)
}
}
asm void __init_hardware() {
ASM void __init_hardware() {
#ifdef __MWERKS__ // clang-format off
nofralloc
mfmsr r0
@@ -179,7 +179,7 @@ asm void __init_hardware() {
#endif // clang-format on
}
asm void __flush_cache(void* addr, u32 size)
ASM void __flush_cache(void* addr, u32 size)
{
#ifdef __MWERKS__
nofralloc