gwsystems / composite

A component-based OS
composite.seas.gwu.edu
185 stars 70 forks source link

Implementation of user-level fault handler #362

Closed WenyuanShao closed 6 years ago

WenyuanShao commented 6 years ago

Summary of this Pull Request (PR)

This pull request is intended to get feedback of the implementation of fault handler.

Core related changes:

  1. Implemented 7 different fault handlers in the llbooter. When a fault happens the system will make a sinv call to the llbooter to handle the fault. Made an allocation of the sinv_cap of these fault handlers in the llbooter. The location of these sinv_caps in the captbl of each component have been hardcoded in cos_types.h.

  2. Changed the sret_ret to make sure the system will use iret instead of sysexit when dealing with a fault. The registers will be restored before the fault is returned. I have added a 'fault_flag' in the invstk push and pop function to tell the sret_ret it is a normal sinv or a sinv of a fault handler.

  3. Changed the exception.c file to save the fault regs and make a sinv call to the user-level fault handler. I have added a function called fault_handler_sinv which basically intended to reduce the redundancy of the code.

Now the user-level fault handler returns without and operation so the fault will repeat. I plan to kill the faulting thread to 'handle' the fault.

Intent for your PR

Choose one (Mandatory):

Reviewers (Mandatory):

@gparmer , @hungry-foolish , @phanikishoreg

Code Quality

As part of this pull request, I've considered the following:

[Style]

[Code Craftsmanship]:

Testing

I've tested the code using the following test programs (provide list here):

I've used pingpong test to test my code. (If a fault happens in ping, the llbooter will be able to 'handle' it)

gparmer commented 6 years ago

After you make changes, you can submit a new PR.

I'd prefer the 4 argument stuff to be in a separate PR, and I think that is ready to merge, but requires you to run more of the tests.