diff options
| author | Carlos Maiolino <[email protected]> | 2025-07-10 22:20:01 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-07-10 22:20:01 +0200 |
| commit | 20834dcc57537cd95260a4a22f5d91a027adfd35 (patch) | |
| tree | 60f21143382380c3cd54110b4134f6fa98000a9b /x86_64/arithmetic.s | |
| parent | 8c6fc0c15415b32080a848bbde640e104098cf13 (diff) | |
Add x86_64 asm
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'x86_64/arithmetic.s')
| -rw-r--r-- | x86_64/arithmetic.s | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/x86_64/arithmetic.s b/x86_64/arithmetic.s new file mode 100644 index 0000000..34216f1 --- /dev/null +++ b/x86_64/arithmetic.s @@ -0,0 +1,22 @@ +# Simple program exercising CPU's arithmetic instructions + +.globl _start + +.section .text + +_start: + movq $3, %rdi + movq %rdi, %rax + mulq %rdi + movq $2, %rdi + addq %rdi, %rax + movq $4, %rdi + mulq %rdi + + movq $10, %rax + movq $3, %rdi + divq %rdi # Remainder goes to %rdx + movq %rax, %rdi + + mov $60, %rax + syscall |
