Add _is_known_flag func

This commit is contained in:
2026-09-13 21:49:53 -04:00
parent 71c9a4fb36
commit cf66f92aae
3 changed files with 56 additions and 6 deletions
+4 -4
View File
@@ -2,7 +2,7 @@
sp_start: .space 8
.section .text
.globl save_sp, fetch_argc, fetch_argv, has_switch
.globl save_sp, fetch_argc, fetch_argv, has_switch, str_cmp
save_sp:
sd sp, sp_start, t0 # save the stack pointer
@@ -125,13 +125,13 @@ has_switch:
mv a0, s3 # load argv buff addr into a0 (string 0)
mv a1, s0 # move switch ptr 1 addr into a1 (string 1)
call _str_cmp
call str_cmp
bnez a1, .LSwitchFound # if the strings match, exit loop
beqz s1, .LSkipSecondSwitch # if we have no second switch, skip the check
mv a0, s3 # move argv buff addr into a0 (string 0)
mv a1, s1 # move switch ptr 2 addr into a1 (string 1)
call _str_cmp
call str_cmp
bnez a1, .LSwitchFound # if the strings match, exit loop
.LSkipSecondSwitch:
@@ -170,7 +170,7 @@ has_switch:
# @param[in] a1: str buffer 2
# @param[out] a0: result code.
# @param[out] a1: is equal (0-no, 1-yes).
_str_cmp:
str_cmp:
li t2, 0
.LByteCmp: