1 /* Declarations for asmcode.S */ 2 3 #ifndef H_ASMCODE 4 #define H_ASMCODE 5 6 #include "emu.h" 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 #if defined(__arm__) || defined(__aarch64__) 13 // Supply the pointer to the instruction directly to avoid read_instruction 14 void translation_enter(void *ptr) __asm__("translation_enter"); 15 #define TRANSLATION_ENTER_HAS_PTR 1 16 #else 17 void translation_enter() __asm__("translation_enter"); 18 #define TRANSLATION_ENTER_HAS_PTR 0 19 #endif 20 21 // Jump to the translated code starting at ptr. 22 // Checks for cycle_count_delta and exits if necessary. 23 void translation_jmp(void *ptr) __asm__("translation_jmp"); 24 // Checks whether code at ptr is now translated and if so, jumps to it 25 void translation_jmp_ptr(void *ptr) __asm__("translation_jmp_ptr"); 26 27 void * FASTCALL read_instruction(uint32_t addr) __asm__("read_instruction"); 28 uint32_t FASTCALL read_byte(uint32_t addr) __asm__("read_byte"); 29 uint32_t FASTCALL read_half(uint32_t addr) __asm__("read_half"); 30 uint32_t FASTCALL read_word(uint32_t addr) __asm__("read_word"); 31 void FASTCALL write_byte(uint32_t addr, uint32_t value) __asm__("write_byte"); 32 void FASTCALL write_half(uint32_t addr, uint32_t value) __asm__("write_half"); 33 void FASTCALL write_word(uint32_t addr, uint32_t value) __asm__("write_word"); 34 35 #if defined(__arm__) || defined(__aarch64__) || defined(__x86_64__) 36 // For some JITs there's in internal version called by JIT'ed code that can't be called 37 // from outside the JIT'ed code 38 uint32_t FASTCALL read_byte_asm(uint32_t addr) __asm__("read_byte_asm"); 39 uint32_t FASTCALL read_half_asm(uint32_t addr) __asm__("read_half_asm"); 40 uint32_t FASTCALL read_word_asm(uint32_t addr) __asm__("read_word_asm"); 41 void FASTCALL write_byte_asm(uint32_t addr, uint32_t value) __asm__("write_byte_asm"); 42 void FASTCALL write_half_asm(uint32_t addr, uint32_t value) __asm__("write_half_asm"); 43 void FASTCALL write_word_asm(uint32_t addr, uint32_t value) __asm__("write_word_asm"); 44 #endif 45 46 #ifdef __cplusplus 47 } 48 #endif 49 50 #endif 51