SPO600 Lab 4 - Part 2: x86_64

smitgabani

Smit Gabani

Posted on November 3, 2022

SPO600 Lab 4 - Part 2: x86_64
  • Connecting to israel server.
ssh username@portugal.cdot.systems // replace username with your username.
Enter fullscreen mode Exit fullscreen mode
  • Copy and unpack tarball, which for a windows user like me can be a new experience.
cp /public/filename ~
tar -xvzf filename
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

The code did not work for me on the portugal server.

💖 💪 🙅 🚩
smitgabani
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.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024

How to Use KitOps with MLflow
beginners How to Use KitOps with MLflow

November 29, 2024