diff --git a/common/type_system/TypeSystem.cpp b/common/type_system/TypeSystem.cpp index 76e4005c59..7922eb90d1 100644 --- a/common/type_system/TypeSystem.cpp +++ b/common/type_system/TypeSystem.cpp @@ -3,6 +3,7 @@ #include "TypeSystem.h" #include "type_util.h" #include +#include TypeSystem::TypeSystem() { // the "none" type is included by default. diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index f35f7dc47d..8b0f502456 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -22,6 +22,10 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif(CMAKE_COMPILER_IS_GNUCXX) enable_language(ASM_NASM) +#set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) +set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS} asm) +set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") +set_source_files_properties(kernel/asm_funcs.asm PROPERTIES COMPILE_FLAGS "-g") set(RUNTIME_SOURCE main.cpp runtime.cpp @@ -35,7 +39,7 @@ set(RUNTIME_SOURCE sce/sif_ee.cpp sce/iop.cpp sce/stubs.cpp - kernel/asm_funcs.nasm + kernel/asm_funcs.asm kernel/fileio.cpp kernel/kboot.cpp kernel/kdgo.cpp diff --git a/game/kernel/asm_funcs.nasm b/game/kernel/asm_funcs.asm similarity index 71% rename from game/kernel/asm_funcs.nasm rename to game/kernel/asm_funcs.asm index d449265338..0e506f23f0 100644 --- a/game/kernel/asm_funcs.nasm +++ b/game/kernel/asm_funcs.asm @@ -32,10 +32,12 @@ _format: push rdi ; set the first argument register to the stack argument array - mov rdi, rsp + mov rcx, rsp + sub rsp, 32 ; call C function to do format, result will go in RAX call format_impl + add rsp, 32 ; restore ; (note - this could probably just be add rsp 72, we don't care about the value of these register) @@ -70,29 +72,41 @@ _format: global _call_goal_asm _call_goal_asm: - ;; x86 saved registers we need to modify for GOAL should be saved - push r13 - push r14 - push r15 - - ;; RDI - first arg - ;; RSI - second arg - ;; RDX - third arg - ;; RCX - function pointer (goes in r13) - ;; R8 - st (goes in r14) - ;; R9 - off (goes in r15) - - ;; set GOAL function pointer - mov r13, rcx - ;; offset - mov r15, r8 - ;; symbol table - mov r14, r9 - ;; call GOAL by function pointer + push rdx ; 8 + push rbx ; 16 + push rbp ; 24 + push rsi ; 32 + push rdi ; 40 + push r8 ; 48 + push r9 ; 56 + push r10 ; 64 + push r11 ; 72 + push r12 ; 80 + push r13 ; 88 + push r14 ; 96 + push r15 ; 104 + + mov rdi, rcx ;; rdi is GOAL first argument, rcx is windows first argument + mov rsi, rdx ;; rsi is GOAL second argument, rdx is windows second argument + mov rdx, r8 ;; rdx is GOAL third argument, r8 is windows third argument + mov r13, r9 ;; r13 is GOAL fp, r9 is windows fourth argument + mov r14, [rsp + 144] ;; symbol table + mov r15, [rsp + 152] ;; offset + call r13 - - ;; retore x86 registers. + pop r15 pop r14 pop r13 - ret \ No newline at end of file + pop r12 + pop r11 + pop r10 + pop r9 + pop r8 + pop rdi + pop rsi + pop rbp + pop rbx + pop rdx + + ret