Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The original program that needs to be modified: #include #include #include #define PAGE_NUMBER 0xFFFFF000 #define OFFSET 0x00000FFF int main(int argc, char *argv[]) { int pageNumber,

The original program that needs to be modified:

#include

#include

#include

#define PAGE_NUMBER 0xFFFFF000

#define OFFSET 0x00000FFF

int main(int argc, char *argv[]) {

int pageNumber, offset;

unsigned int entry;

entry = (unsigned int)atoi(argv[1]);

if (argc != 2) {

fprintf(stderr, "Please enter: ./assign4_1 followed by the virtual address");

return -1;

}

printf("The address %d contains: ", entry);

//Mask the page number

pageNumber = (entry & PAGE_NUMBER) >> 12;

offset = entry & OFFSET;

printf("page number = %d ", pageNumber);

printf("offset = %d ", offset);

return 0;

}

The requirements for the problem:

image text in transcribed

Change your program, Program-1, such that it takes as input an address-space (eg, v= 32- bit), a page-size (eg, s = 4KB), and an address (eg, a = 19986), and returns the page number and the offset number of the input address (eg, p = 4 and d=3602). Both v and s should be powers of 2, s

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

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

Answered: 1 week ago