add syscalls
This commit is contained in:
parent
527354bad2
commit
9722873b8f
|
@ -3,7 +3,7 @@
|
|||
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
# replace this with your project's name
|
||||
project(unshell C)
|
||||
project(unshell C ASM)
|
||||
|
||||
include(GenerateG1A)
|
||||
include(GenerateG3A)
|
||||
|
@ -18,6 +18,7 @@ set(SOURCES
|
|||
src/main.c
|
||||
src/term.c
|
||||
src/ui.c
|
||||
src/syscalls.S
|
||||
# ...
|
||||
)
|
||||
# shared assets
|
||||
|
@ -66,6 +67,9 @@ set(FLAGS
|
|||
-Os
|
||||
)
|
||||
|
||||
set(ASM_OPTIONS "-x assembler-with-cpp")
|
||||
set(CMAKE_ASM_FLAGS "${ASM_OPTIONS}")
|
||||
|
||||
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
||||
|
||||
add_executable(Main ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
.global __poweroff
|
||||
.global __battery
|
||||
.global __battery_type
|
||||
|
||||
.section ".text"
|
||||
|
||||
#define syscall(id) \
|
||||
mov.l syscall_table, r2 ;\
|
||||
mov.l 1f, r0 ;\
|
||||
jmp @r2 ;\
|
||||
nop ;\
|
||||
.align 4 ;\
|
||||
1: .long id
|
||||
|
||||
#ifdef FX9860G
|
||||
|
||||
syscall_table:
|
||||
.long 0x80010070
|
||||
|
||||
#endif /* FX9860G */
|
||||
|
||||
#ifdef FXCG50
|
||||
|
||||
__poweroff:
|
||||
syscall(0x1839)
|
||||
|
||||
__battery:
|
||||
syscall(0x1186)
|
||||
|
||||
__battery_type:
|
||||
syscall(0x12d5)
|
||||
|
||||
syscall_table:
|
||||
.long 0x80020070
|
||||
|
||||
#endif /* FXCG50 */
|
Loading…
Reference in New Issue