Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Context Switching- Please answer the parts of the question below and explain. Thank you 5. Below is the code for swtch) from xv6 1 #

Context Switching- Please answer the parts of the question below and explain. Thank you

image text in transcribed

5. Below is the code for swtch) from xv6 1 # Context switch 2# 3 # void swtch struct context ** old , struct context *new); 5 # save current register context in old 6 # and then load register context from new 8 .globl swtch 10 movl 4( esp ), %eax 11 movl B ( esp ), %edx 12 13 # save old callee - 8ave registers 14 pushl %ebp 15 pushl %ebx 16 pushl sesi 17 pushl sedi 18 19 # switch stacks 20 movi esp , (% eax ) 21 movi tedx , %esp 23 # Load new callee - save registers 24 popl Sedi 25 popl %esi 26 popl Sebx 27 popl Sebp 28 ret (a) (5 points) How is the program counter (%eip) saved and restored by this code? (b) (5 points) Give an example of one other piece of program state that is not explicitly saved by this code and explain why that doesn't cause problems when performing a context switch. 5. Below is the code for swtch) from xv6 1 # Context switch 2# 3 # void swtch struct context ** old , struct context *new); 5 # save current register context in old 6 # and then load register context from new 8 .globl swtch 10 movl 4( esp ), %eax 11 movl B ( esp ), %edx 12 13 # save old callee - 8ave registers 14 pushl %ebp 15 pushl %ebx 16 pushl sesi 17 pushl sedi 18 19 # switch stacks 20 movi esp , (% eax ) 21 movi tedx , %esp 23 # Load new callee - save registers 24 popl Sedi 25 popl %esi 26 popl Sebx 27 popl Sebp 28 ret (a) (5 points) How is the program counter (%eip) saved and restored by this code? (b) (5 points) Give an example of one other piece of program state that is not explicitly saved by this code and explain why that doesn't cause problems when performing a context switch

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_2

Step: 3

blur-text-image_3

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions