Implement aligned funcs

This commit is contained in:
Prakxo
2023-02-15 09:41:25 +00:00
parent 79bb2ae6e3
commit 169f213772
15 changed files with 112 additions and 18 deletions
+1
View File
@@ -13,3 +13,4 @@ dump/*
*.exe
*.dll
build.ninja
ac-decomp.code-workspace
+4
View File
@@ -325,9 +325,13 @@ SDK_CFLAG = [
"-sdata 4",
f"-sdata2 {DOL_SDATA2_SIZE}"
]
ALIGN16_CFLAG = [
"-func_align 16",
]
DOL_CFLAGS = ' '.join(BASE_DOL_CFLAGS + LOCAL_CFLAGS)
SDK_FLAGS = ' '.join(SDK_CFLAG + LOCAL_CFLAGS)
ALIGN16 = ' '.join(BASE_DOL_CFLAGS + LOCAL_CFLAGS + ALIGN16_CFLAG)
REL_CFLAGS = ' '.join(BASE_REL_CFLAGS + LOCAL_CFLAGS)
EXTERNAL_DOL_CFLAGS = ' '.join(BASE_DOL_CFLAGS)
EXTERNAL_REL_CFLAGS = ' '.join(BASE_REL_CFLAGS)
+9 -2
View File
@@ -22,8 +22,15 @@ dolphin/OS/OSRestoreInterrupts.c:
MSL_C/rand.c:
.text: [0x8009f46c, 0x8009f494]
.sdata: [0x80218260, 0x80218268]
libultra/ultra.c:
.text: [0x8005d01c, 0x8005d090]
#libultra/ultra.c:
# .text: [0x8005d01c, 0x8005d15c]
# .bss: [0x80206f60, 0x80206fa0]
libultra/gu/sins.c:
.text: [0x8005e860, 0x8005e8ac]
.data: [0x800dd360, 0x800ddb60]
dolphin/odenotstub/odenotstub.c:
.text: [0x800a9770, 0x800a9780]
dolphin/amcstubs/AmcExi2Stubs.c:
.text: [0x800a8cc0, 0x800a8cf0]
dolphin/gx/GXStubs.c:
.text: [0x800998d4, 0x800998d8]
+4
View File
@@ -82,6 +82,7 @@ n.variable("elf2rel", c.ELF2REL)
n.variable("codewarrior", c.CODEWARRIOR)
n.variable("cc", c.CC)
n.variable("occ", c.OCC)
n.variable("align16", c.ALIGN16)
n.variable("ld", c.LD)
n.variable("devkitppc", c.DEVKITPPC)
n.variable("as", c.AS)
@@ -575,6 +576,9 @@ class CSource(Source):
if path.startswith("src/dolphin/"):
self.cflags = c.SDK_FLAGS
self.cc = c.OCC
elif path.startswith("src/odenotstub"):
self.cc = c.CC
self.cflags = c.ALIGN16
else:
self.cflags = ctx.cflags
self.cc = c.CC
+5 -3
View File
@@ -1,6 +1,7 @@
#pragma once
#ifndef _MEM_H
#define _MEM_H
#include <stddef.h>
#include "types.h"
#ifdef __cplusplus
extern "C" {
@@ -15,5 +16,6 @@ void __fill_mem(void * dst, int val, unsigned long n);
#pragma section code_type
#ifdef __cplusplus
}
};
#endif
#endif
+2 -1
View File
@@ -5,7 +5,8 @@
extern "C" {
#endif
asm s32 OSGetTime(void);
typedef s64 OSTime;
OSTime OSGetTime(void);
#ifdef __cplusplus
}
+2
View File
@@ -3,11 +3,13 @@
#include "types.h"
#include "dolphin/OS/OSContext.h"
#include "va_args.h"
#ifdef __cplusplus
extern "C" {
#endif
void OSReport(const char*, ...);
void OSVReport(const char* format, va_list list);
asm BOOL OSDisableInterrupts(void);
asm BOOL OSEnableInterrupts(void);
+3 -4
View File
@@ -3,16 +3,15 @@
#include "types.h"
#include "dolphin/OS/OSTime.h"
#include "dolphin/OS/OSCache.h"
int bcmp (void *v1, void *v2, u32 size);
void bcopy(void *dst, void *src, size_t n);
void bzero(void *ptr, size_t size);
void osSyncPrintf(const char* fmt, ...);
void osWritebackDCache(void* vaddr, u32 nbytes);
u32 osGetCount(void);
OSTime osGetTime(void);
extern s32 osAppNMIBuffer[15];
extern void * memcpy(void * dst, const void * src, size_t n);
extern void * memset(void * dst, int val, size_t n);
extern void __fill_mem(void * dst, int val, unsigned long n);
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef __VA_ARG_H
#define __VA_ARG_H
#include "types.h"
typedef struct __va_list_struct {
char gpr;
char fpr;
char reserved[2];
char* input_arg_area;
char* reg_save_area;
} _va_list_struct;
typedef _va_list_struct __va_list[1];
#define __va_start(list, fmt) __builtin_va_info(&list)
#define __va_arg(list, type) (*((type*)__va_arg(ap, _var_arg_typeof(type))))
#define va_start __va_start
#define va_arg __va_arg
#define va_end __va_end
#define va_list __va_list
#define __va_end(list) ((void)0)
#endif
+2 -2
View File
@@ -5,8 +5,8 @@
#include "dolphin/OS/os.h"
#include "libultra/libultra.h"
#include "JSystem/JUT/JUTAssertion.h"
#include "JSystem/JUT/JUTDbPrint.h"
//#include "JSystem/JUT/JUTAssertion.h"
//#include "JSystem/JUT/JUTDbPrint.h"
typedef struct zuru_keycheck {
u8 state;
+29
View File
@@ -0,0 +1,29 @@
#include "types.h"
void EXI2_Init(void){
}
void EXI2_EnableInterrupts(void){
}
u8 EXI2_Poll(void){
return 0;
}
u8 EXI2_ReadN(void){
return 0;
}
u8 EXI2_WriteN(void){
return 0;
}
void EXI2_Reserve(void){
}
void EXI2_Unreserve(void){
}
u8 AMC_IsStub(void){
return 1;
}
+5
View File
@@ -0,0 +1,5 @@
#include "types.h"
void __GXSetRange(void){
}
+5
View File
@@ -0,0 +1,5 @@
#include "types.h"
BOOL Hu_IsStub(void){
return 0;
}
+16 -5
View File
@@ -1,4 +1,9 @@
#include "libultra/libultra.h"
#include "_mem.h"
#include "dolphin/OS/os.h"
#include "dolphin/OS/OSTime.h"
extern OSTime __osTimeOffset;
void bcopy(void* __src, void* __dst, size_t __n) {
memmove(__dst, __src, __n);
@@ -12,12 +17,18 @@ int bcmp(void* __s1, void* __s2, size_t __n) {
void bzero(void* __s, size_t __n) {
memset(__s, 0, __n);
}
void osSyncPrintf(const char* format, ...){
va_list arg;
va_start(arg, format);
OSVReport(format, arg);
va_end(arg);
//void osWritebackDCache(void* buf, u32 len){
// DCStoreRange(buf, len);
//}
}
void osWritebackDCache(void* buf, u32 len){
DCStoreRange(buf, len);
}
/* s32 osGetCount(void){
u32 osGetCount(void){
return OSGetTick();
}
*/