diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-27 17:18:06 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-27 17:18:06 +0200 |
commit | d485cd2ba9e869da4d8cbb2a83da64652ca6caca (patch) | |
tree | 4b583556f69dbb06da3ffa0de5d68a031df86b0b | |
parent | Better comments (diff) | |
download | lowbat-bsd-d485cd2ba9e869da4d8cbb2a83da64652ca6caca.tar.gz lowbat-bsd-d485cd2ba9e869da4d8cbb2a83da64652ca6caca.tar.bz2 lowbat-bsd-d485cd2ba9e869da4d8cbb2a83da64652ca6caca.tar.xz lowbat-bsd-d485cd2ba9e869da4d8cbb2a83da64652ca6caca.tar.zst lowbat-bsd-d485cd2ba9e869da4d8cbb2a83da64652ca6caca.zip |
f_status rewrite
-rw-r--r-- | asm/f_percent.asm | 6 | ||||
-rw-r--r-- | asm/f_status.asm | 48 |
2 files changed, 30 insertions, 24 deletions
diff --git a/asm/f_percent.asm b/asm/f_percent.asm index 82b560e..d38daef 100644 --- a/asm/f_percent.asm +++ b/asm/f_percent.asm @@ -45,6 +45,6 @@ err: retq .data - f_cmd: .asciz "apm -l >/tmp/lowbat.percent" - pr_file: .asciz "/tmp/lowbat.percent" - buff: .byte 0x0, 0x0, 0x0, 0x0 + f_cmd: .asciz "apm -l >/tmp/lowbat.percent" + pr_file: .asciz "/tmp/lowbat.percent" + buff: .byte 0x0, 0x0, 0x0, 0x0 diff --git a/asm/f_status.asm b/asm/f_status.asm index 092a88c..c07a2f3 100644 --- a/asm/f_status.asm +++ b/asm/f_status.asm @@ -19,35 +19,41 @@ /* 3: charging */ /***************/ -section .text - extern system - global jo_f_status +.text +.extern system +.globl f_status -jo_f_status: - mov rdi, f_cmd - call system - mov rdi, st_file - mov rsi, 0x0 - mov rax, 0x5 +f_status: + movq $f_cmd, %rdi + callq system + movq $st_file, %rdi + xorq %rsi, %rsi + xorq %rax, %rax + movb $0x5, %al /* sys_open */ syscall jc err - mov rdi, rax - mov rsi, buff - mov rdx, 0x1 - mov rax, 0x3 + movq %rax, %rdi + movq $buff, %rsi + xorq %rdx, %rdx + xorq %rax, %rax + movb $0x1, %dl + movb $0x3, %al /* sys_read */ syscall jc err - mov rax, 0x6 + xorq %rax, %rax + movb $0x6, %al /* sys_close */ syscall - movsx rax, byte [rsi + 0x0] - sub rax, 0x30 + xorq %rax, %rax + movb (%rsi), %al + subb $0x30, %al retq err: - mov rax, 0xfe + xorq %rax, %rax + movb $0xfe, %al retq -section .data - f_cmd: db "apm -b > /tmp/lowbat.status", 0x0 - st_file: db "/tmp/lowbat.status", 0x0 - buff: db 0x0, 0x0 +.data + f_cmd: .asciz "apm -b >/tmp/lowbat.status" + st_file: .asciz "/tmp/lowbat.status" + buff: .byte 0x0, 0x0 |