Save sp
This commit is contained in:
+16
-3
@@ -1,9 +1,22 @@
|
||||
.globl fetch_argc, fetch_argv
|
||||
.data
|
||||
sp_start: .space 8
|
||||
|
||||
.section .text
|
||||
.globl save_sp, fetch_argc, fetch_argv
|
||||
|
||||
save_sp:
|
||||
sd sp, sp_start, t0 # save the stack pointer
|
||||
ret
|
||||
|
||||
# Fetch argument count
|
||||
# @param[in] a0: unused.
|
||||
# @param[out] a0: number of arguments.
|
||||
fetch_argc:
|
||||
ld a0, 0(sp)
|
||||
ld t0, sp_start # dereference the buffer
|
||||
ld a0, 0(t0) # dereference the address
|
||||
ret
|
||||
|
||||
|
||||
# Fetch argument value
|
||||
# @param[in] a0: argv[a0].
|
||||
# @param[out] a0: address of arg.
|
||||
fetch_argv:
|
||||
|
||||
Reference in New Issue
Block a user