EBK COMPUTER SYSTEMS
3rd Edition
ISBN: 8220101459107
Author: O'HALLARON
Publisher: YUZU
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 3.10, Problem 3.48PP
A.
Program Plan Intro
Load Effective Address:
- The load effective address instruction “leaq” is a variant of “movq” instruction.
- The instruction form reads memory to a register, but memory is not been referenced at all.
- The first operand of instruction is a memory reference; the effective address is been copied to destination.
- The pointers could be generated for later references of memory.
- The common arithmetic operations could be described compactly using this instruction.
- The operand in destination should be a register.
Data movement instructions:
- The different instructions are been grouped as “instruction classes”.
- The instructions in a class performs same operation but with different sizes of operand.
- The “Mov” class denotes data movement instructions that copy data from a source location to a destination.
- The class has 4 instructions that includes:
- movb:
- It copies data from a source location to a destination.
- It denotes an instruction that operates on 1 byte data size.
- movw:
- It copies data from a source location to a destination.
- It denotes an instruction that operates on 2 bytes data size.
- movl:
- It copies data from a source location to a destination.
- It denotes an instruction that operates on 4 bytes data size.
- movq:
- It copies data from a source location to a destination.
- It denotes an instruction that operates on 8 bytes data size.
- movb:
Comparison Instruction:
- The “CMP” instruction sets condition code according to differences of their two operands.
- The working pattern is same as “SUB” instruction but it sets condition code without updating destinations.
- The zero flag is been set if two operands are equal.
- The ordering relations between operands could be determined using other flags.
- The “cmpl” instruction compares values that are double word.
Unary and Binary Operations:
- The details of unary operations includes:
- The single operand functions as both source as well as destination.
- It can either be a memory location or a register.
- The instruction “incq” causes 8 byte element on stack top to be incremented.
- The instruction “decq” causes 8 byte element on stack top to be decremented.
- The details of binary operations includes:
- The first operand denotes the source.
- The second operand works as both source as well as destination.
- The first operand can either be an immediate value, memory location or register.
- The second operand can either be a register or a memory location.
B.
Explanation of Solution
Rearranged ordering provides greater security:
- In protected code, the local variables “v” is placed closer to stack top than “buf”...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(C Program) Write a recursive function called PrintLinkedList() that outputs the integer value of each node in a linked list. Function PrintLinkedList() has one parameter, the head node of a list. The main program reads the size of the linked list, followed by the values in the list. Assume the linked list has at least 1 node.
Needs C++ Solution!
) We use a 32-bit operating system. Its int types, memory addresses, and registers, such as ESP, EBP and EIP, are represented by 32 bits. We compile a program that calls this function in this operating system.
int foo(int x) {
int y, z;
y = x+3;
z = x * 2;
return z;
}
Please plot the stack frame of foo function before it returns.
Chapter 3 Solutions
EBK COMPUTER SYSTEMS
Ch. 3.4 - Prob. 3.1PPCh. 3.4 - Prob. 3.2PPCh. 3.4 - Prob. 3.3PPCh. 3.4 - Prob. 3.4PPCh. 3.4 - Prob. 3.5PPCh. 3.5 - Prob. 3.6PPCh. 3.5 - Prob. 3.7PPCh. 3.5 - Prob. 3.8PPCh. 3.5 - Prob. 3.9PPCh. 3.5 - Prob. 3.10PP
Ch. 3.5 - Prob. 3.11PPCh. 3.5 - Prob. 3.12PPCh. 3.6 - Prob. 3.13PPCh. 3.6 - Prob. 3.14PPCh. 3.6 - Prob. 3.15PPCh. 3.6 - Prob. 3.16PPCh. 3.6 - Practice Problem 3.17 (solution page 331) An...Ch. 3.6 - Practice Problem 3.18 (solution page 332) Starting...Ch. 3.6 - Prob. 3.19PPCh. 3.6 - Prob. 3.20PPCh. 3.6 - Prob. 3.21PPCh. 3.6 - Prob. 3.22PPCh. 3.6 - Prob. 3.23PPCh. 3.6 - Practice Problem 3.24 (solution page 335) For C...Ch. 3.6 - Prob. 3.25PPCh. 3.6 - Prob. 3.26PPCh. 3.6 - Practice Problem 3.27 (solution page 336) Write...Ch. 3.6 - Prob. 3.28PPCh. 3.6 - Prob. 3.29PPCh. 3.6 - Practice Problem 3.30 (solution page 338) In the C...Ch. 3.6 - Prob. 3.31PPCh. 3.7 - Prob. 3.32PPCh. 3.7 - Prob. 3.33PPCh. 3.7 - Prob. 3.34PPCh. 3.7 - Prob. 3.35PPCh. 3.8 - Prob. 3.36PPCh. 3.8 - Prob. 3.37PPCh. 3.8 - Prob. 3.38PPCh. 3.8 - Prob. 3.39PPCh. 3.8 - Prob. 3.40PPCh. 3.9 - Prob. 3.41PPCh. 3.9 - Prob. 3.42PPCh. 3.9 - Practice Problem 3.43 (solution page 344) Suppose...Ch. 3.9 - Prob. 3.44PPCh. 3.9 - Prob. 3.45PPCh. 3.10 - Prob. 3.46PPCh. 3.10 - Prob. 3.47PPCh. 3.10 - Prob. 3.48PPCh. 3.10 - Prob. 3.49PPCh. 3.11 - Practice Problem 3.50 (solution page 347) For the...Ch. 3.11 - Prob. 3.51PPCh. 3.11 - Prob. 3.52PPCh. 3.11 - Practice Problem 3.52 (solution page 348) For the...Ch. 3.11 - Practice Problem 3.54 (solution page 349) Function...Ch. 3.11 - Prob. 3.55PPCh. 3.11 - Prob. 3.56PPCh. 3.11 - Practice Problem 3.57 (solution page 350) Function...Ch. 3 - For a function with prototype long decoda2(long x,...Ch. 3 - The following code computes the 128-bit product of...Ch. 3 - Prob. 3.60HWCh. 3 - In Section 3.6.6, we examined the following code...Ch. 3 - The code that follows shows an example of...Ch. 3 - This problem will give you a chance to reverb...Ch. 3 - Consider the following source code, where R, S,...Ch. 3 - The following code transposes the elements of an M...Ch. 3 - Prob. 3.66HWCh. 3 - For this exercise, we will examine the code...Ch. 3 - Prob. 3.68HWCh. 3 - Prob. 3.69HWCh. 3 - Consider the following union declaration: This...Ch. 3 - Prob. 3.71HWCh. 3 - Prob. 3.72HWCh. 3 - Prob. 3.73HWCh. 3 - Prob. 3.74HWCh. 3 - Prob. 3.75HW
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.Similar questions
- Problem 1. (RSA Library) Implement a library called rea.py that provides functions needed for developing the RSA cryp- tosystem. The library must support the following API: rsa generates and returns the public/private keys as a tuple (n, e, d), picking prime numbers p and q needed to generate the keys from the interval [1o, hi) encrypts x (int) using the public key (a, e) and returns the encrypted value decrypts y (int) using the private key (a, d) and returns the decrypted value returns the least number of bits needed to represent a returns the binary representation of a expressed in decimal, having the given width and padded with leading zeros returns the decimal representation of a expressed in binary keygen (lo, hi) евcrypt (x, a, е) decrypt (y, n, d) bitLength (n) dec2bin (n, width) bin2dec (n) > "/vorkspace/project4 $ python3 rsa.py S encrypt (S)- 1743 decrypt (1743) - s bitlength (83) - 7 dec2bin (83) - 1010011 bin2dec (1010011) - 83 Directions: 4 / 7 Project 4 (RSA…arrow_forward(Exhaustive Search: The Assignment Problem) Complete the application of exhaustive search to The following assignment: [9 2 7 8] 64 37 5818 769 4 C = 1, 2, 3, 4 1, 2, 4, 3 1, 3, 2, 4 1, 3, 4, 2 1, 4, 2, 3 1, 4, 3, 2 Complete the remaining cases: Answer: cost = 9+4+1+4 = 18 cost = 9+4+8+9 = 30 cost = 9+3+8+4 = 24 cost = 9+3+8+6 = 26 cost = 9+7+8+9 = 33 cost = 9+7+1+6 = 23arrow_forwardIn C++ please make a program that calculates the sum of two polynomials using LINKED LINEAR LISTS similar interface that shows in the given imagearrow_forward
- Solve the problem using C++ (Evaluate expression) Modify Listing 12.12 EvaluateExpression.cpp to add operators ^ for exponent and % for modulus. For example, 3 ^ 2 is 9 and 3 % 2 is 1. The ^ operator has the highest precedence and the % operator has the same precedence as the * and / operators. Sample Run Enter an expression: (5 * 2 ^ 3 + 2 * 3 % 2) * 4 (5 * 2 ^ 3 + 2 * 3 % 2) * 4 = 160arrow_forwardAnswer the given question with a proper explanation and step-by-step solution. C++ 11.12 LAB: Fibonacci sequence (recursion) The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of the previous two, for example: 0, 1, 1, 2, 3, 5, 8, 13. Complete the Fibonacci() function, which takes in an index, n, and returns the nth value in the sequence. Any negative index values should return -1. Ex: If the input is: 7 the output is: Fibonacci(7) is 13 Note: Use recursion and DO NOT use any loops. main.cpp #include <iostream>using namespace std; int Fibonacci(int n) {/* Type your code here. */ } int main() {int startNum;cin >> startNum;cout << "Fibonacci(" << startNum << ") is " << Fibonacci(startNum) << endl;return 0;}arrow_forward02: (a) What is recursive function in C++ language give an example? (b) Detect the four errors in the following C+t program: #include void main ) ( int ip, x; int arr[6]=[ 10, 34, 13, 76, 5, 46 ]; ip = *arr[01: for (x 0; x < 6; x++) { cout << ip; %3D (*ip)++:arrow_forward
- (C is the language) " Your task is to create the CPU execution scheduler where the jobs are kept in a priority queue implemented as a binary heap. Make this a round robin type of execution where the jobs are deleted from the heap, executed for 2 time units, and re-inserted with a lower priority into the priority queue. Jobs that have completed execution would not be re-inserted into the heap. New jobs could come in at a priority that might be higher than the aging jobs. . For example, the following tree represents a Maximum binary heap. Each node indicates the priority and the total execution time of each process. This a round robin type of execution where the jobs are deleted from the heap, The system assigns the next CPU time (time slice) which is 2 unit to the highest priority process. Your code should have the following functions: Create Binary tree Delete Scheduling Insertion Heapify"arrow_forward(Python)Develop a C module for applying selection sort. The result should be like Figure 1.arrow_forward(C++) I need a quicksort algorithm implementation which returns the indices of the sorted array in an array without modifying the array itself:ie,Before sortingindex : 0 1 2 3 4 5values: 70 60 40 20 30 50After sortingindex : 3 4 2 5 1 0values: 70 60 40 20 30 50 function returns an array with indexes: [3 4 2 5 1 0]arrow_forward
- (C Language) Write a recursive function called PrintNumPattern() to output the following number pattern. Given a positive integer as input (Ex: 12), subtract another positive integer (Ex: 3) continually until a negative value is reached, and then continually add the second integer until the first integer is again reached. For this lab, do not end output with a newline.arrow_forward(c) A palindromic number is a number that is the same if read forwards or backwards: 12321 and 641146 are examples. It is possible to represent a number using an array of digits (numbers 0- 9), for example: [1,9,5, 2] could represent 1952. i. Using an appropriate iteration construct, write an algorithm as a procedure that decides if an input array A[1..n] of digits is a palindromic number.arrow_forward(c90)In my code below , can you help me achieve all the points in the image : #include <stdio.h>#include <stdlib.h>#include <string.h>#include <float.h>#include "graph.h"#include "dijkstra.h" #define INFINITY DBL_MAX /* find shortest paths between source node id and all other nodes in graph. *//* upon success, returns an array containing a table of shortest paths. *//* return NULL if *graph is uninitialised or an error occurs. *//* each entry of the table array should be a Path *//* structure containing the path information for the shortest path between *//* the source node and every node in the graph. If no path exists to a *//* particular desination node, then next should be set to -1 and weight *//* to DBL_MAX in the Path structure for this node */Path *dijkstra(Graph *graph, int id, int *pnEntries){ int n; int i, j; int* nv = get_vertices(graph, &n); int *S = malloc(n * sizeof(int)); double *D = malloc(n * sizeof(double));…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr