Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have no idea what im supposed to do or how to do it, I'd really appreciate steps with an explanation so I can understand

I have no idea what im supposed to do or how to do it, I'd really appreciate steps with an explanation so I can understand why you did it.

image text in transcribed
image text in transcribed
image text in transcribed

====== p2_yw.s code template

.equ locals, 8

.global _start

_start:

sub sp, sp, #16 // space for fp, lr

str fp, [sp, #0] // save fp

str lr, [sp, #8] // and lr

add fp, sp, #8 // set our frame pointer

sub sp, sp, locals // space for locals

mov x1, 85 // number #85 is to to be printed

// the code above should NOT be modified

// BEGIN

// add your code here to enable the print of int

// END

// the code below should NOT be modified, except the .data section

mov x0, #1

mov x1, x1 // redundant; just to show you

mov x2, #3 // x1 is part of the sys call

mov x8, #64

svc 0

mov x0, #0

add sp, sp, locals

ldr fp, [sp, #0]

ldr lr, [sp, #8]

add sp, sp, #16

/* syscall exit(int status) */

mov x0, #0 /* status := 0 */

mov x8, #93 /* exit is syscall #1 */

svc #0 /* invoke syscall */

// YOU MAY ADD a .data or other directives BELOW

==== General ideas 1. P2 extends the P1 code to print a 2-digit unsigned integer. The objective is to understand why ARMv8 is best known as the "load \& store" ISA. Your code will be tested with a different integer. 2. For the time being, do not worry about the code outside of BEGIN/END as stated below; it will be explained in full later. Concentrate on transforming the 1 register using load \& store mechanism as discussed in class, so that it can be printed by syscall \#64 . ==== Submission requirements 1. Use the baseline code below per our in-class discussion. Follow the requirements closely. 2. Your submission should include: 1) p2_lastname.s, and 2) a screenshot showing the gdb session displaying the value of the x1 register after it has been transformed for memory examination. Basically, x1 initially holds an int, and your assembly code needs to transform it so that the initial int can be printed with the \#64 syscall outside of the BEGIN/END block. 3. Your code should not invoke any other library call inside the BEGIN/END pair. Hard wire a string to represent the integer will not earn credit. 4. Please do NOT submit a zip file. Upload two files to Canvas: .s and.pdf. ======p2_yw.s code template .equ locals, 8 global_start _start: sub sp,,sp,#16// space for fp,Ir str fp,[sp,#0]// save fp str Ir, [sp,#8]// and Ir add fp,sp, \#8 // set our frame pointer sub sp, sp, locals // space for locals mov x1,85// number \#85 is to to be printed // the code above should NOT be modified I/ BEGIN x0,#1 mov x1,x1// redundant; just to show you mov 2,#3//1 is part of the sys call mov x8,#64 sve 0 mov x0,#0 add sp,sp, locals ldr fp,[sp,#0] Idr r,[sp,#8] add sp,sp, \#16 I syscall exit(int status) / mov x0,#0I status : =0 mov x8,#93I exit is syscall \#1 / sve \#0 invoke syscall % // YOU MAY ADD a data or other directives BELOW

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

5-8 What are the advantages and disadvantages of the BYOD movement?

Answered: 1 week ago