check for supervisor protection fault and issue a bus error
This commit is contained in:
@@ -380,7 +380,7 @@ reset_vector:
|
|||||||
jmp _rom_entry // no, cold start machine
|
jmp _rom_entry // no, cold start machine
|
||||||
|
|
||||||
access:
|
access:
|
||||||
move.w #0x2700,sr // disable interrupt
|
move.w #0x2700,sr // disable interrupts
|
||||||
move.l d0,-(sp) // ++ vr
|
move.l d0,-(sp) // ++ vr
|
||||||
|
|
||||||
move.w 4(sp),d0 // get format_status word from stack
|
move.w 4(sp),d0 // get format_status word from stack
|
||||||
@@ -400,6 +400,12 @@ access_mmu:
|
|||||||
move.l MCF_MMU_MMUSR,d0 // did the last fault hit in TLB?
|
move.l MCF_MMU_MMUSR,d0 // did the last fault hit in TLB?
|
||||||
btst #1,d0 // yes, it did. So we already mapped that page
|
btst #1,d0 // yes, it did. So we already mapped that page
|
||||||
bne bus_error // and this must be a real bus error
|
bne bus_error // and this must be a real bus error
|
||||||
|
btst #5,d0 // supervisor protection fault?
|
||||||
|
bne bus_error
|
||||||
|
btst #4,d0 // read access fault?
|
||||||
|
bne bus_error
|
||||||
|
btst #3,d0 // write access fault?
|
||||||
|
bne bus_error
|
||||||
|
|
||||||
move.l MCF_MMU_MMUAR,d0
|
move.l MCF_MMU_MMUAR,d0
|
||||||
cmp.l #__FASTRAM_END,d0 // above max User RAM area?
|
cmp.l #__FASTRAM_END,d0 // above max User RAM area?
|
||||||
|
|||||||
@@ -235,6 +235,7 @@ int mmu_map_page(uint32_t virt, uint32_t phys, enum mmu_page_size sz, const stru
|
|||||||
MCF_MMU_MMUTR_ID(flags->page_id) | /* address space id (ASID) */
|
MCF_MMU_MMUTR_ID(flags->page_id) | /* address space id (ASID) */
|
||||||
MCF_MMU_MMUTR_SG | /* shared global */
|
MCF_MMU_MMUTR_SG | /* shared global */
|
||||||
MCF_MMU_MMUTR_V; /* valid */
|
MCF_MMU_MMUTR_V; /* valid */
|
||||||
|
NOP();
|
||||||
|
|
||||||
MCF_MMU_MMUDR = ((int) phys & size_mask) | /* physical address */
|
MCF_MMU_MMUDR = ((int) phys & size_mask) | /* physical address */
|
||||||
MCF_MMU_MMUDR_SZ(sz) | /* page size */
|
MCF_MMU_MMUDR_SZ(sz) | /* page size */
|
||||||
@@ -243,9 +244,11 @@ int mmu_map_page(uint32_t virt, uint32_t phys, enum mmu_page_size sz, const stru
|
|||||||
(flags->access & ACCESS_WRITE ? MCF_MMU_MMUDR_W : 0) | /* write access enable */
|
(flags->access & ACCESS_WRITE ? MCF_MMU_MMUDR_W : 0) | /* write access enable */
|
||||||
(flags->access & ACCESS_EXECUTE ? MCF_MMU_MMUDR_X : 0) | /* execute access enable */
|
(flags->access & ACCESS_EXECUTE ? MCF_MMU_MMUDR_X : 0) | /* execute access enable */
|
||||||
(flags->locked ? MCF_MMU_MMUDR_LK : 0);
|
(flags->locked ? MCF_MMU_MMUDR_LK : 0);
|
||||||
|
NOP();
|
||||||
|
|
||||||
MCF_MMU_MMUOR = MCF_MMU_MMUOR_ACC | /* access TLB, data */
|
MCF_MMU_MMUOR = MCF_MMU_MMUOR_ACC | /* access TLB, data */
|
||||||
MCF_MMU_MMUOR_UAA; /* update allocation address field */
|
MCF_MMU_MMUOR_UAA; /* update allocation address field */
|
||||||
|
NOP();
|
||||||
|
|
||||||
MCF_MMU_MMUOR = MCF_MMU_MMUOR_ITLB | /* instruction */
|
MCF_MMU_MMUOR = MCF_MMU_MMUOR_ITLB | /* instruction */
|
||||||
MCF_MMU_MMUOR_ACC | /* access TLB */
|
MCF_MMU_MMUOR_ACC | /* access TLB */
|
||||||
|
|||||||
Reference in New Issue
Block a user