Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) (3 points) On line 15 of the C code, in the argint function, why do we add 4 to proc - >tf - >esp

image text in transcribed

(a) (3 points) On line 15 of the C code, in the argint function, why do we add 4 to

proc - >tf - >esp ?

(b) On that same line, why do we multiply n by 4?

(c) What could go wrong if xv6 didn't have the check at line 5 in fetchint ?

2. The following is the code that implements the kill system call in xv6 Assembly Code 1 kill 3 int $0x40 4 ret C code 1// Fetch the int at addr from the current process 2 int fetchint uint addr ,int *ip) 5 if addr proc ->z I addr +4 > proc ->z) 7 *ip = *( int *) ( addr ); return1 8 return 0 10 11 // Fetch the nth 32-bit system call argument 12 int 13 argint (int n, int *ip) 14 15 return fetchint (proc ->tf ->esp 4 + 4*n, ip 16 17 18 int 19 sys_kil1 ( void ) 20 21 int pid 23 if ( argint (0, &pid) z I addr +4 > proc ->z) 7 *ip = *( int *) ( addr ); return1 8 return 0 10 11 // Fetch the nth 32-bit system call argument 12 int 13 argint (int n, int *ip) 14 15 return fetchint (proc ->tf ->esp 4 + 4*n, ip 16 17 18 int 19 sys_kil1 ( void ) 20 21 int pid 23 if ( argint (0, &pid)

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

List and describe the three operations of a relational DBMS.

Answered: 1 week ago

Question

3 The distinction between microeconomics and macroeconomics.

Answered: 1 week ago

Question

2 The role of economic theory in economics.

Answered: 1 week ago