Reference no: EM132650493
CS 354 Operating Systems - Purdue University
Lab: Interrupt Handling in XINU and Trapped System Call Implementation
Objectives
The objectives of this lab are to understand XINU's basic interrupt handling on x86 Galileo backends for synchronous interrupts: source of interrupt is an exception, also called fault, and software interrupt int. We will then utilize the int instruction to code XINU system calls as trapped calls following the classical method for implementing systems calls in Linux and Windows on x86 computers.
For the written components of the problems below, please write your answers in a file, lab2answers.pdf, and put it under lab2/. You may use any number of word processing software as long as they are able to export content as pdf files using standard fonts. Written answers in any other format will not be accepted.
Please use a fresh copy of XINU, xinu-fall2020.tar.gz, but for preserving the myhello() function from lab1 and removing all code related to xsh from main() (i.e., you are starting with an empty main()). Hence NPROC and the priority of the null process remain at their original values 100 and 0. Note that main() serves as an app for your own testing purposes. The TAs when evaluating your code will use their own main() to test your XINU kernel modifications.
3. Custom handling of divide-by-zero exception
The consequence of a process performing a divide-by-zero ALU operation is for the CPU to generate an interrupt to inform the operating system. By default, the operating system will terminate the process with the understanding that dividing by zero is a bug and continuing the process's computation is not meaningful. In this problem, we will customize the handling of the divide-by-zero exception by XINU on our x86 backends.
4. New XINU system call: uptimesec()
Implement a new XINU system call, uint32 uptimesec(void), in uptimesec.c under system/ that returns the number of seconds that have elapsed since XINU was bootstrapped on a backend. XINU keeps track of this quantity in global variable, uint32 clktime, declared in include/clock.h. clktime is maintained by XINU's clock interrupt handling code clkdisp in clkdisp.S which is installed as the 33rd entry of IDT by clkinit() during system initialization. clkinit() is called after the other entries of IDT (XINU uses 48 out of the 256 total) are initialized by initevec(). clkdisp calls C function clkhandler() in clkhandler.c which is the lower half kernel function that actually maintains clktime.
5. Trapped XINU system calls
As discussed in the lectures and evident by inspection of any XINU system call code, all XINU system calls are regular C function calls. That is, there is no special trap instruction that switches a process from user mode to kernel mode and jumps to a kernel function in the upper half of the kernel to carry out the requested service. A system call in XINU is not a wrapper function that acts as a gateway to a kernel function that actually performs the system call task. It is the actual kernel function. Isolation/protection is a core feature of general-purposes operating systems such as Linux and Windows which is necessary for reliability. It is essential for security. Not supporting isolation/protection, in computing environments where it makes sense, is the exception to the rule. In this problem, we will re-implement two XINU system calls -- legacy system call chprio() and new system call uptimesec() -- into trapped versions using a traditional technique followed by Linux and Windows for x86 machines.
Bonus problem
Extend the trapped XINU system calls to include getpid(). Place the wrapper function xgetpid() in xgetpid.c and use extended inline assembly to trap to the system call dispatcher. Assign xgetpid() system call number 9. To prevent potential issues when extending XINU to include xgetpid(), save a copy that does not include xgetpid() and maintain the extended kernel including xgetpid() separately. You can use Git, RCS, or any number of version control tools to keep track of your code. Saving earlier versions in separate folders will work as well. Test that your implementation works correctly.
Attachment:- lab.rar
How is accounts receivable reported on the balance sheet
: In a merchandising business, when merchandise is sold on account, a journal entry is booked to Debit to Accounts Receivable and Credit to Sales. In addition
|
Dot product and cross product of two vectors
: What is the dot product AND cross product of these two vectors?
|
Explain the concept of break-even point
: Explain the concept of 'break-even' point and justify your answers in requirements (a) and (c) above, with the calculation using contribution margin format
|
Initial angular momentum and angular speed of plate
: After the ring collides with the plate, will the final angular momentum and final angular speed be more than, less than, or the same as the initial angular mome
|
CS 354 Operating Systems Assignment
: CS 354 Operating Systems Assignment Help and Solution, Purdue University - Assessment Writing Service - Interrupt Handling in XINU and Trapped System Call
|
What menthod use to prepare consolidated financial statement
: Non-controlling interest's share of the subsidiary's goodwill cannot be reliably determined, the method used to prepare consolidated financial statements is
|
How long was the package in the air
: If the horizontal distance between the point of release and the point at which the package hit the ground is 685.0 m, how long was the package in the air?
|
Determine the total company cost in both purchase
: Which bid should the Logistics Services division accept for a company as a whole? Internal bid from Forwarders Division. External bid from United Systems
|
Magnitude of the force by the spring on the block
: When a block of mass 1 = 1 kg is attached to the end of the spring and the system is allowed to reach equilibrium, the length of the spring is 1 = 0.5 m.
|