Module 5 - CS 271

Ace your homework & exams now with Quizwiz!

Which of the following code sequences assigns the value 10 to EBX?

MOV EDX, 20 PUSH EDX MOV ECX, 10 PUSH ECX POP EBX POP EDX

High-level languages always pass arrays to subroutines by value.

False

PUSHF is used to preserve all general purpose register contents on the stack.

False

In the IA32 architecture, ESP (the stack pointer) is incremented each time data is popped from the stack.

True

Mechanically speaking, the CALL instruction pushes its return address on the stack and copies the called procedure's address into the instruction pointer.

True

Passing by reference requires accessing a parameter's offset from inside the called procedure.

True

Select the proper syntax for establishing a subprocedure.

procedureName PROC ;... ;... RET ;return to calling procedure procedureName ENDP

Given the following procedures, with code segment instruction addresses given on each line in 4 byte hex... 00000000 main PROC ; ... ; Execution Point A 0000001A CALL someProc1 0000001F CALL WriteDec ; ... 00000030 exit 00000031 main ENDP 00000031 someProc1 PROC 00000031 PUSH EAX 00000035 CALL someProc2 0000003A POP EAX ; Execution Point B ; ... 0000016F RET 0000016F someProc1 ENDP 0000016F someProc2 PROC 0000016F PUSH EBX ; ... 00000205 POP EBX 00000209 RET 0000020A someProc2 ENDP Assume ESP = 000004DAh, EAX = 00000040h, EBX = 00000120h at Execution Point A Current value of stack pointer at execution point B? Value at top of stack at execution point B?

4D6 1F

The stack frame inside a procedure is also known as the ____________.

Activation Record

Which of the following instructions always modify the ESP register? (Check all that apply) JMP CALL JNE RET PUSH DEC POP INC

CALL RET PUSH POP

The RET instruction pops the top of the stack into what register?

EIP

Values passed to a subroutine by a calling program are called __________.

arguments

A stack is also called a FIFO structure (First-In, First-Out) because the last value put into the stack is always the first value taken out.

False

Which offers a more flexible approach, passing arguments to procedures in registers, or on the stack?

on the stack

When values are received by a called subroutine, they are called __________.

parameters

Which of the following are normally part of the stack frame? (Select all that apply) - Calling Procedure Starting Address - Arguments - Local Variables - Saved Register Values - Return Address

- Arguments - Local Variables - Saved Register Values - Return Address

What will be the value of EAX when the following sequence of instructions has executed? PUSH 5 PUSH 10 POP EBX POP EAX

5

Given the following procedures, with code segment instruction addresses given on each line in 4 byte hex... ESP = 00000900h at Execution Point A 00000000 main PROC ; ... Execution Point A 0000011C CALL doSomething 00000120 MOV result, EAX ; ... 0000023E exit 0000023F main ENDP 0000023F checkThings PROC ; ... 00000243 XOR BX, 0A00h ; Execution Point B ; ... 00000274 RET 00000275 checkThings ENDP 00000275 doSomething PROC ; ... 000002A0 CALL checkThings 000002A5 MOV EAX, EDX ; ... 000002F3 RET 000002F4 doSomething ENDP Value of stack pointer at execution point B? Value at top of stack at execution point B?

8F8 2A5

Assume ESP equals 1C3Fh at Execution Point A. Trace the following code to Execution Point B, then answer the questions below. MOV EAX, 7 MOV EBX, 11 MOV ECX, 42 MOV EDX, 99 ; Nine Nine! ;Execution Point A PUSH EBX PUSH ECX PUSH EAX PUSH EDX POP ECX ; Execution Point B POP EDX POP EBX POP EAX Value of ECX (dec) Value of ESP (hex) Value of [ESP] (dec)

ECX = 99d ESP = 1C33h [ESP] = 7

What single instruction would I use to save all general purpose registers?

PUSHAD

A stack frame is _____

The area of the stack set aside for passed arguments, return address, local variables, and saved registers.

An argument passed by reference consists of a memory address offset.

True

Arrays are passed by reference to avoid copying each element into the stack/registers.

True

The USES operator, coupled with the PROC directive, lets you list the names of all registers modified within a procedure and preserves them automatically for you.

True


Related study sets

Chapter 13 Windows Operating System

View Set

Ciao Professore! Vocabolario Utile- (Fuentes)

View Set

Finance Kansas License Practice Exam pt. 2

View Set

SIE Practice Exam #1 (score: 84%)

View Set

Pediatric Exam 2: School Age Child/Adolescent Developmental Notes, Acute Pediatric Illnesses Notes: Respiratory, Cardiac, GI, GU

View Set

Anatomy Week #3: Upper Limb II - Forearm, Wrist Joint & Hand

View Set