diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-27 13:55:39 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-27 13:55:39 +0200 |
commit | 8e9173a29b1f451056cec374c55086df69e5d816 (patch) | |
tree | 6d6c0467b74fffce3121ea94eb374dc14efba465 | |
parent | Removed old version (diff) | |
download | lowbat-bsd-8e9173a29b1f451056cec374c55086df69e5d816.tar.gz lowbat-bsd-8e9173a29b1f451056cec374c55086df69e5d816.tar.bz2 lowbat-bsd-8e9173a29b1f451056cec374c55086df69e5d816.tar.xz lowbat-bsd-8e9173a29b1f451056cec374c55086df69e5d816.tar.zst lowbat-bsd-8e9173a29b1f451056cec374c55086df69e5d816.zip |
Good
-rw-r--r-- | asm/c_args.asm | 4 | ||||
-rw-r--r-- | asm/f_percent.asm | 53 |
2 files changed, 31 insertions, 26 deletions
diff --git a/asm/c_args.asm b/asm/c_args.asm index 7e036a9..441e4c3 100644 --- a/asm/c_args.asm +++ b/asm/c_args.asm @@ -18,8 +18,8 @@ /* ******************************* */ .text - .extern strncmp - .globl c_args +.extern strncmp +.globl c_args c_args: cmp $0x2, %rdi diff --git a/asm/f_percent.asm b/asm/f_percent.asm index 3a5c1c8..539e2e7 100644 --- a/asm/f_percent.asm +++ b/asm/f_percent.asm @@ -10,38 +10,43 @@ /* */ /* ************************************************************************************ */ -section .text - extern system - extern atoi - global jo_f_percent +.text + .extern printf +.extern system +.extern atoi +.globl f_percent +.globl main -jo_f_percent: - mov rdi, f_cmd - call system - mov rdi, pr_file - mov rsi, 0x0 - mov rax, 0x5 +f_percent: + movq $f_cmd, %rdi + callq system + movq $pr_file, %rdi + xorq %rsi, %rsi + xorq %rax, %rax + movb $0x5, %al /* sys_open */ syscall jc err - mov rdi, rax - mov rsi, buff - mov rdx, 0x3 - mov rax, 0x3 + movq %rax, %rdi + movq $buff, %rsi + xorq %rdx, %rdx + xorq %rax, %rax + movb $0x3, %dl + movb $0x3, %al /* sys_read */ syscall jc err - mov rax, 0x6 + xorq %rax, %rax + movb $0x6, %al /* sys_close */ syscall - xor rax, rax - mov rdi, rsi - call atoi + xorq %rax, %rax + movq %rsi, %rdi + callq atoi retq err: - mov rax, 0xfe + movq $0xfe, %rax retq - -section .data - f_cmd: db "apm -l > /tmp/lowbat.percent", 0x0 - pr_file: db "/tmp/lowbat.percent", 0x0 - buff: db 0x0, 0x0, 0x0, 0x0 +.data + f_cmd: .asciz "apm -l >/tmp/lowbat.percent" + pr_file: .asciz "/tmp/lowbat.percent" + buff: .byte 0x0, 0x0, 0x0, 0x0 |