On armv6 and later, use the WriteNotRead bit of the fault status register

to decide what protections are required by the faulting access.  The old
code disassembled the faulting instruction, and there are a lot of new
instructions that aren't handled.  The old code is still used for armv4/5
which doesn't have the WNR bit)
This commit is contained in:
Ian Lepore 2014-02-12 18:55:26 +00:00
parent 9f23d19a5e
commit bcaa399985

View File

@ -386,17 +386,16 @@ data_abort_handler(struct trapframe *tf)
}
/*
* We need to know whether the page should be mapped
* as R or R/W. The MMU does not give us the info as
* to whether the fault was caused by a read or a write.
*
* However, we know that a permission fault can only be
* the result of a write to a read-only location, so
* we can deal with those quickly.
*
* Otherwise we need to disassemble the instruction
* responsible to determine if it was a write.
* We need to know whether the page should be mapped as R or R/W. On
* armv6 and later the fault status register indicates whether the
* access was a read or write. Prior to armv6, we know that a
* permission fault can only be the result of a write to a read-only
* location, so we can deal with those quickly. Otherwise we need to
* disassemble the faulting instruction to determine if it was a write.
*/
#ifdef _ARM_ARCH_6
ftype = (fsr & FAULT_WNR) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ;
#else
if (IS_PERMISSION_FAULT(fsr))
ftype = VM_PROT_WRITE;
else {
@ -412,6 +411,7 @@ data_abort_handler(struct trapframe *tf)
else
ftype = VM_PROT_READ;
}
#endif
}
/*