Crate fault_crate_swap

source ·
Expand description

Defines support functions needed for swapping of corrupted crates to a different address for fault tolerance

Structs

  • A data structure to hold the ranges of memory used by the old crate and the new crate. The crate only maintains the values as virtual addresses and holds no references to any crate

Functions

  • A support function for self swap of crate Iterates through a given set of address from top to bottom and checks whether they fall within the range of an old crate and shifts them by a constant offset to map them to correct region in the new crate. Fix is as follows if virtual address matches. new_address = old_address - start_address_of_old_text_region + start_address_of_new_text_region. Address ranges are provided via SwapRanges struct. Uses unsafe logic for pointer manipulation
  • For swapping of a crate from the identical object file in the disk. Wraps arpund the crate_swap function by creating an appropriate Swap request. Arguments identical to the ones of crate_swap except namespace : Arc to the current namespace Returns a SwapRanges struct indicating the old and new VirtualAddress range of the swapped crate
  • This function returns the name of the crate to replace if required. Returns none if no crate is needed to be replaced.
  • This function calls the crate swapping routine for a corrupted crate (referred to as self swap) Swapping a crate with a new copy of object file includes following steps in high level