SPO600 Lab 4 - Part 2: x86_64
Smit Gabani
Posted on November 3, 2022
- Connecting to israel server.
ssh username@portugal.cdot.systems // replace username with your username.
- Copy and unpack tarball, which for a windows user like me can be a new experience.
cp /public/filename ~
tar -xvzf filename
- Modify the loop to run until 30 iterations (which took hours for me)
We need more steps to make the division work which makes the code longer and harder to make it work.
My x86_64 code:
.text
.globl _start
min = 0
max = 30
_start:
mov $min,%r15
mov $10, %r14
mov $10, %r13
mov %r15,%r13
mov %r15,%r14
mov $10,%r8
movq $len,%rdx
loop:
mov $0, %r11
mov %r9, %r12
div %r8
add $'0',%12
movb %r14b,msg+6
inner:
add $'0', %11
movb %r13b,msg+7
movq $msg,%rsi
movq $1,%rdi
movq $1,%rax
syscall
inc %r15
cmp $max,%r15
jne loop
movq $0,%rdi
movq $60,%rax
syscall
.section .data
msg: .ascii "Loop: ##\n"
len = . - msg
The code did not work for me on the portugal server.
💖 💪 🙅 🚩
Smit Gabani
Posted on November 3, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.