Subversion Repositories HelenOS-historic

Rev

Rev 993 | Rev 1080 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 993 Rev 1044
Line 421... Line 421...
421
    region_register rr;
421
    region_register rr;
422
    __address va;
422
    __address va;
423
    pte_t *t;
423
    pte_t *t;
424
   
424
   
425
    va = istate->cr_ifa;    /* faulting address */
425
    va = istate->cr_ifa;    /* faulting address */
-
 
426
    page_table_lock(AS, true);
426
    t = page_mapping_find(AS, va);
427
    t = page_mapping_find(AS, va);
427
    if (t) {
428
    if (t) {
428
        /*
429
        /*
429
         * The mapping was found in software page hash table.
430
         * The mapping was found in software page hash table.
430
         * Insert it into data translation cache.
431
         * Insert it into data translation cache.
431
         */
432
         */
432
        itc_pte_copy(t);
433
        itc_pte_copy(t);
-
 
434
        page_table_unlock(AS, true);
433
    } else {
435
    } else {
434
        /*
436
        /*
435
         * Forward the page fault to address space page fault handler.
437
         * Forward the page fault to address space page fault handler.
436
         */
438
         */
-
 
439
        page_table_unlock(AS, true);
437
        if (!as_page_fault(va)) {
440
        if (!as_page_fault(va)) {
-
 
441
            page_table_unlock(AS, true);
438
            panic("%s: va=%P, rid=%d\n", __FUNCTION__, istate->cr_ifa, rr.map.rid);
442
            panic("%s: va=%P, rid=%d\n", __FUNCTION__, istate->cr_ifa, rr.map.rid);
439
        }
443
        }
440
    }
444
    }
441
}
445
}
442
 
446
 
Line 464... Line 468...
464
            dtlb_kernel_mapping_insert(va, KA2PA(va), false, 0);
468
            dtlb_kernel_mapping_insert(va, KA2PA(va), false, 0);
465
            return;
469
            return;
466
        }
470
        }
467
    }
471
    }
468
 
472
 
-
 
473
    page_table_lock(AS, true);
469
    t = page_mapping_find(AS, va);
474
    t = page_mapping_find(AS, va);
470
    if (t) {
475
    if (t) {
471
        /*
476
        /*
472
         * The mapping was found in software page hash table.
477
         * The mapping was found in software page hash table.
473
         * Insert it into data translation cache.
478
         * Insert it into data translation cache.
474
         */
479
         */
475
        dtc_pte_copy(t);
480
        dtc_pte_copy(t);
-
 
481
        page_table_unlock(AS, true);
476
    } else {
482
    } else {
477
        /*
483
        /*
478
         * Forward the page fault to address space page fault handler.
484
         * Forward the page fault to address space page fault handler.
479
         */
485
         */
-
 
486
        page_table_unlock(AS, true);
480
        if (!as_page_fault(va)) {
487
        if (!as_page_fault(va)) {
481
            panic("%s: va=%P, rid=%d, iip=%P\n", __FUNCTION__, va, rid, istate->cr_iip);
488
            panic("%s: va=%P, rid=%d, iip=%P\n", __FUNCTION__, va, rid, istate->cr_iip);
482
        }
489
        }
483
    }
490
    }
484
}
491
}
Line 502... Line 509...
502
 */
509
 */
503
void data_dirty_bit_fault(__u64 vector, istate_t *istate)
510
void data_dirty_bit_fault(__u64 vector, istate_t *istate)
504
{
511
{
505
    pte_t *t;
512
    pte_t *t;
506
 
513
 
-
 
514
    page_table_lock(AS, true);
507
    t = page_mapping_find(AS, istate->cr_ifa);
515
    t = page_mapping_find(AS, istate->cr_ifa);
508
    ASSERT(t && t->p);
516
    ASSERT(t && t->p);
509
    if (t && t->p) {
517
    if (t && t->p) {
510
        /*
518
        /*
511
         * Update the Dirty bit in page tables and reinsert
519
         * Update the Dirty bit in page tables and reinsert
512
         * the mapping into DTC.
520
         * the mapping into DTC.
513
         */
521
         */
514
        t->d = true;
522
        t->d = true;
515
        dtc_pte_copy(t);
523
        dtc_pte_copy(t);
516
    }
524
    }
-
 
525
    page_table_unlock(AS, true);
517
}
526
}
518
 
527
 
519
/** Instruction access bit fault handler.
528
/** Instruction access bit fault handler.
520
 *
529
 *
521
 * @param vector Interruption vector.
530
 * @param vector Interruption vector.
Line 523... Line 532...
523
 */
532
 */
524
void instruction_access_bit_fault(__u64 vector, istate_t *istate)
533
void instruction_access_bit_fault(__u64 vector, istate_t *istate)
525
{
534
{
526
    pte_t *t;
535
    pte_t *t;
527
 
536
 
-
 
537
    page_table_lock(AS, true);
528
    t = page_mapping_find(AS, istate->cr_ifa);
538
    t = page_mapping_find(AS, istate->cr_ifa);
529
    ASSERT(t && t->p);
539
    ASSERT(t && t->p);
530
    if (t && t->p) {
540
    if (t && t->p) {
531
        /*
541
        /*
532
         * Update the Accessed bit in page tables and reinsert
542
         * Update the Accessed bit in page tables and reinsert
533
         * the mapping into ITC.
543
         * the mapping into ITC.
534
         */
544
         */
535
        t->a = true;
545
        t->a = true;
536
        itc_pte_copy(t);
546
        itc_pte_copy(t);
537
    }
547
    }
-
 
548
    page_table_unlock(AS, true);
538
}
549
}
539
 
550
 
540
/** Data access bit fault handler.
551
/** Data access bit fault handler.
541
 *
552
 *
542
 * @param vector Interruption vector.
553
 * @param vector Interruption vector.
Line 544... Line 555...
544
 */
555
 */
545
void data_access_bit_fault(__u64 vector, istate_t *istate)
556
void data_access_bit_fault(__u64 vector, istate_t *istate)
546
{
557
{
547
    pte_t *t;
558
    pte_t *t;
548
 
559
 
-
 
560
    page_table_lock(AS, true);
549
    t = page_mapping_find(AS, istate->cr_ifa);
561
    t = page_mapping_find(AS, istate->cr_ifa);
550
    ASSERT(t && t->p);
562
    ASSERT(t && t->p);
551
    if (t && t->p) {
563
    if (t && t->p) {
552
        /*
564
        /*
553
         * Update the Accessed bit in page tables and reinsert
565
         * Update the Accessed bit in page tables and reinsert
554
         * the mapping into DTC.
566
         * the mapping into DTC.
555
         */
567
         */
556
        t->a = true;
568
        t->a = true;
557
        dtc_pte_copy(t);
569
        dtc_pte_copy(t);
558
    }
570
    }
-
 
571
    page_table_unlock(AS, true);
559
}
572
}
560
 
573
 
561
/** Page not present fault handler.
574
/** Page not present fault handler.
562
 *
575
 *
563
 * @param vector Interruption vector.
576
 * @param vector Interruption vector.
Line 568... Line 581...
568
    region_register rr;
581
    region_register rr;
569
    __address va;
582
    __address va;
570
    pte_t *t;
583
    pte_t *t;
571
   
584
   
572
    va = istate->cr_ifa;    /* faulting address */
585
    va = istate->cr_ifa;    /* faulting address */
-
 
586
    page_table_lock(AS, true);
573
    t = page_mapping_find(AS, va);
587
    t = page_mapping_find(AS, va);
574
    ASSERT(t);
588
    ASSERT(t);
575
   
589
   
576
    if (t->p) {
590
    if (t->p) {
577
        /*
591
        /*
Line 580... Line 594...
580
         */
594
         */
581
        if (t->x)
595
        if (t->x)
582
            itc_pte_copy(t);
596
            itc_pte_copy(t);
583
        else
597
        else
584
            dtc_pte_copy(t);
598
            dtc_pte_copy(t);
-
 
599
        page_table_unlock(AS, true);
585
    } else {
600
    } else {
-
 
601
        page_table_unlock(AS, true);
586
        if (!as_page_fault(va)) {
602
        if (!as_page_fault(va)) {
587
            panic("%s: va=%P, rid=%d\n", __FUNCTION__, va, rr.map.rid);
603
            panic("%s: va=%P, rid=%d\n", __FUNCTION__, va, rr.map.rid);
588
        }
604
        }
589
    }
605
    }
590
}
606
}