Gauntlet/docs/Data_Abort_Path
Created by Adam Wiggins: 22/09/1999
Last Modified by Adam Wiggins: 03/10/1999
Data Abort Psudo Code for Development

Data_Abort_Dispatch (Non-FASS)
{
  if (SPSR & MODE_MASK) // Abort generated in a Kernel Mode
    if((FAR >= TCB_START) && (FAR < TCB_LIMIT)) 
      switch (FSR.Status) {
        case TRANSLATION_SECTION: // Map Page Table Leaf, execute next case too
          Add_Page_Table_Leaf();
        case TRANSLATION_PAGE: // Map Null TCB frame
          Map_Null_TCB();
          break;
        case PERMISSION_PAGE: // Map fresh TCB frame 
          Map_Fresh_TCB();
          break;
        default: // Kernel should not raise other abort status on TCB space
          Kernel_Panic(GENERAL_DATA_ABORT);
      }
    else // Kernel shoud not raise data aborts anywhere else (until Long IPC)
      Kernel_Panic(GENERAL_DATA_ABORT);
  else // Abort generated in User Mode       
    switch (FSR.Status) {
      case TRANSLATION_SECTION: // User Page Fault
      case TRANSLATION_PAGE:
      case PERMISSION_SECTION:
      case PERMISSION_PAGE:
        User_Page_Fault();
        break;
      default: // User Exception
        User_Exception();
    }
}

User_Page_Fault()
{
  // Generate Page Fault IPC to User Thread's pager_tid
}

User_Exception()
{
  // Generate Exception IPC to User Thread's excpt_tid
}

/* This is for the FASS version cut from the Non-FASS version */
    else if((FAR >= PAGE_DIR_START) && (FAR < PAGE_DIR_LIMIT))
      switch (FSR.Status) {
        case TRANSLATION_SECTION: // Map Page Table Leaf, execute next case too
          Add_Page_Table_Leaf();
        case TRANSLATION_PAGE: // Map Page Directory frame
          Map_Page_Dir
          break;
        default: // Kernel should not raise other abort status on Page Dir space
          Kernel_Panic(GENERAL_DATA_ABORT);
      }

Data_Abort_Dispatch (FASS)
{
  if (SPSR & MODE_MASK) { // Abort generated in a Kernel Mode
    switch (FSR.Status) {
      case TRANSLATION_SECTION: // Map Page Table Leaf, execute next case too
        // FILL ME
      case TRANSLATION_PAGE: // Map Null TCB frame or Page Directory frame
        // FILL ME
        break;
      case PERMISSION_PAGE: // Map fresh TCB frame 
        // FILL ME
        break;
      default: // Kernel shouldn't fault on other status
        Kernel_Panic(GENERAL_DATA_ABORT)
    }
  } else { // Abort generated in User Mode
    switch (FSR.Status) {
      case TRANSLATION_SECTION: // Could be Page Fault or CPD Load 
        // FILL ME
        break;
      case DOMAIN_SECTION: // Could be Page Fault or CPD Replacement
      case DOMAIN_PAGE:    // Could be Page Fault or CPD Replacement
        // FILL ME
        break; 
      case TRANSLATION_PAGE:   // Page Fault
      case PERMISSION_SECTION: // Page Fault
      case PERMISSION_PAGE:    // Page Fault
        User_Page_Fault
        break;
      default: // Other status indicates Exception
        User_Exception()
    }
  }
}
