示例#1
0
文件: tlb.c 项目: cfrost/buenos
void tlb_common_exception(void) {
    tlb_exception_state_t tlb_es;
    _tlb_get_exception_state(&tlb_es);
    pagetable_t *current_pagetable;
    current_pagetable = thread_get_current_thread_entry()->pagetable;
    if (current_pagetable == NULL) {
        KERNEL_PANIC("Pagetable is non-existing");
    }
    uint32_t i;
    for (i = 0; i < current_pagetable->valid_count; i++) {
        tlb_entry_t *entry = &current_pagetable->entries[i];
        // find addr fra pagetable og put i tlb. 
        if (entry->VPN2 == tlb_es.badvpn2) {
            
            KERNEL_ASSERT(entry->VPN2 == tlb_es.badvaddr >> 13);

            /* Checks if address is odd( see vm.c)
             * and thereafter checks validbit */

            if (ADDR_IS_ON_ODD_PAGE(tlb_es.badvaddr)){
                KERNEL_ASSERT(entry->V1);
            } else {
                KERNEL_ASSERT(entry->V0);
            }

            // Inserting into a random entry of the tlb.
            _tlb_write_random(&current_pagetable->entries[i]);
            return;
        }
    }
示例#2
0
文件: tlb.c 项目: cfrost/buenos
// send terminate signal to process
void tlb_modified_exception(void) {
    tlb_exception_state_t tlb_es;
    _tlb_get_exception_state(&tlb_es);
    pagetable_t *current_pagetable;
    current_pagetable = thread_get_current_thread_entry()->pagetable;
    
    if (current_pagetable == NULL) {
        KERNEL_PANIC("Pagetable is non-existing");
    }
    
    uint32_t i;
    for (i = 0; i < current_pagetable->valid_count; i++) {
        tlb_entry_t *entry = &current_pagetable->entries[i];
        // find addr fra pagetable og put i tlb. 
        if (entry->VPN2 == tlb_es.badvpn2) {
            
            /* Checks if address is odd( see vm.c)
             * and thereafter checks validbit */
            if (ADDR_IS_ON_ODD_PAGE(entry->VPN2)){
                KERNEL_ASSERT(entry->D1);
            } else {
                KERNEL_ASSERT(entry->D0);
            }
            return;
        }
    }
    KERNEL_PANIC("Unhandled TLB modified exception");
}
示例#3
0
static void print_tlb_debug(void)
{
  tlb_exception_state_t tes;
  _tlb_get_exception_state(&tes);

  kprintf("TLB exception. Details:\n"
          "Failed Virtual Address: 0x%8.8x\n"
          "Virtual Page Number:    0x%8.8x\n"
          "ASID (Thread number):   %d\n",
          tes.badvaddr, tes.badvpn2, tes.asid);
}
示例#4
0
文件: tlb.c 项目: nichodemius/osm
void tlb_seek_insert(void)
{
  tlb_exception_state_t state;
  _tlb_get_exception_state(&state);
  pagetable_t *table = thread_get_current_thread_entry()->pagetable;
  for (int i = 0; i < (int)table->valid_count; i++) {
    if (table->entries[i].VPN2 == state.badvpn2) {
      _tlb_write_random(&table->entries[i]);
      return;
    }
  }
  KERNEL_PANIC("Access violation");
}
示例#5
0
文件: tlb.c 项目: erikallin/OSM-2014
void tlb_load_exception(void)
{
// kprintf("STOREAH");
  tlb_exception_state_t state;
  pagetable_t* pagetable;
//fylder en state på vores state.
 _tlb_get_exception_state(&state);
  
  pagetable = thread_get_current_thread_entry()->pagetable;

 _tlb_probe(pagetable->entries); 
 if(tlb_index < 0) { 
   KERNEL_PANIC("pagetable not found!");
 }

  for(uint32_t i = 0; i < pagetable->valid_count; i++) {
        _tlb_write_random((tlb_entry_t*) &pagetable->entries[i]);
  } 

 }