Lab 4 (x86)

 For this lab we were tasked with doing the same loop problem from the aarch64. How ever me being the genius I am I tried to switch to the x86 well still on the Israel server not even thinking to switch to the Portugal one. So After just getting that sorted out I can now attempt to build the code. 

Also unpacking the file was needed again as you can see here: 



I have so far got it loop the hello world out but just need to change it to loop for the ascii message and print the number here is my code so far

min = 0                         /* starting value for the loop index; note that this is a symbol (constant), not a variable */

max = 10                        /* loop exits when the index hits this number (loop condition is i<max) */


_start:

    mov     $min,%r15           /* loop index */


loop:

    /* ... body of the loop ... do something useful here ... */

     movq    $len,%rdx                       /* message length */

     movq    $msg,%rsi                       /* message location */

     movq    $1,%rdi                         /* file descriptor stdout */

     movq    $1,%rax                         /* syscall sys_write */

     syscall



    /* end body of loop */

    inc     %r15                /* increment index */

    cmp     $max,%r15           /* see if we're done */

    jne     loop                /* loop if we're not */


    mov     $0,%rdi             /* exit status */

    mov     $60,%rax            /* syscall sys_exit */

    syscall


.section .data


msg:    .ascii      "Hello, world!\n"

        len = . - msg

here is the output:



I have got it looping 30 times just need to work with the debugger in order to print the loop counter.





Comments

Popular posts from this blog

SPO600 Lab1

SPO600(Project 3.2 FInal Post and thoughts on project and course)

SPO600(Project Part 2.1)