【MIPS CPU 体系结构概述2】连载16:(完)

6. do_page_fault
seems ok

7. swapping
seems ok

8. adding execution protection
2002.3.16:
TLB execute protection bit support.

1. generic support
idea:
use bit 5 in pte to maintain a software version of _PAGE_EXEC modify TLB refill code to reflect it into hardware bit(bit 30)
affected files:
include/asm/pgtable.h:
define _PAGE_EXEC
change related PAGE_XXX macros and protection_map add pte_mkexec/pte_exprotect
add godson_mkexec/godson_mkprotect
arch/mips/mm/tlbex-r4k.S:
tlb_refill exception & PTE_RELOAD macro:
test bit 5 and translated it into bit30 in entrylo
using godson's cp0 register 23/24 as temporary store place Note: bit5 and bit30 have adverse meaning,bit5 set==bit30
cleared==page executable,
arch/mips/mm/tlb-r4k.c:
update_mmu_cache:
test bit 5 and translated it into bit30 in entrylo implement godson_mkexec/godson_exprotect arch/mips/config.in:
add option CONFIG_CPU_HAS_EXECUTE_PROTECTION

2. non-executable stack support
interface:
by default no protection is taken,To take advantage of this support,one should call sysmips syscall to set the flag bit and then execute the target program.
affected files:
include/asm/processor.h:
define MF_STACK_PROTECTION flag

fs/exec.c:
judge which protection to use
arch/mips/kernel/signal.c:
enable/disable execute for signal trampoline arch/mips/math-emu/cp1emu.c:
enable/disable execute for delay slot emulation trampoline arch/mips/kernel/sysmips.c:
handle MF_STACK_PROTECTION

--电子创新网--
粤ICP备12070055号