sh64: Utilize thread fault code encoding.
This plugs in fault code encoding for the sh64 page fault, too. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
5a1dc78a38
commit
9a7b7739f9
@ -1079,9 +1079,8 @@ restore_all:
|
|||||||
*
|
*
|
||||||
* Kernel TLB fault handlers will get a slightly different interface.
|
* Kernel TLB fault handlers will get a slightly different interface.
|
||||||
* (r2) struct pt_regs *, original register's frame pointer
|
* (r2) struct pt_regs *, original register's frame pointer
|
||||||
* (r3) writeaccess, whether it's a store fault as opposed to load fault
|
* (r3) page fault error code (see asm/thread_info.h)
|
||||||
* (r4) execaccess, whether it's a ITLB fault as opposed to DTLB fault
|
* (r4) Effective Address of fault
|
||||||
* (r5) Effective Address of fault
|
|
||||||
* (LINK) return address
|
* (LINK) return address
|
||||||
* (SP) = r2
|
* (SP) = r2
|
||||||
*
|
*
|
||||||
@ -1092,26 +1091,25 @@ restore_all:
|
|||||||
tlb_miss_load:
|
tlb_miss_load:
|
||||||
or SP, ZERO, r2
|
or SP, ZERO, r2
|
||||||
or ZERO, ZERO, r3 /* Read */
|
or ZERO, ZERO, r3 /* Read */
|
||||||
or ZERO, ZERO, r4 /* Data */
|
getcon TEA, r4
|
||||||
getcon TEA, r5
|
|
||||||
pta call_do_page_fault, tr0
|
pta call_do_page_fault, tr0
|
||||||
beq ZERO, ZERO, tr0
|
beq ZERO, ZERO, tr0
|
||||||
|
|
||||||
tlb_miss_store:
|
tlb_miss_store:
|
||||||
or SP, ZERO, r2
|
or SP, ZERO, r2
|
||||||
movi 1, r3 /* Write */
|
movi FAULT_CODE_WRITE, r3 /* Write */
|
||||||
or ZERO, ZERO, r4 /* Data */
|
getcon TEA, r4
|
||||||
getcon TEA, r5
|
|
||||||
pta call_do_page_fault, tr0
|
pta call_do_page_fault, tr0
|
||||||
beq ZERO, ZERO, tr0
|
beq ZERO, ZERO, tr0
|
||||||
|
|
||||||
itlb_miss_or_IRQ:
|
itlb_miss_or_IRQ:
|
||||||
pta its_IRQ, tr0
|
pta its_IRQ, tr0
|
||||||
beqi/u r4, EVENT_INTERRUPT, tr0
|
beqi/u r4, EVENT_INTERRUPT, tr0
|
||||||
|
|
||||||
|
/* ITLB miss */
|
||||||
or SP, ZERO, r2
|
or SP, ZERO, r2
|
||||||
or ZERO, ZERO, r3 /* Read */
|
movi FAULT_CODE_ITLB, r3
|
||||||
movi 1, r4 /* Text */
|
getcon TEA, r4
|
||||||
getcon TEA, r5
|
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
|
|
||||||
call_do_page_fault:
|
call_do_page_fault:
|
||||||
|
@ -61,15 +61,17 @@ static pte_t *lookup_pte(struct mm_struct *mm, unsigned long address)
|
|||||||
* and the problem, and then passes it off to one of the appropriate
|
* and the problem, and then passes it off to one of the appropriate
|
||||||
* routines.
|
* routines.
|
||||||
*/
|
*/
|
||||||
asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
|
asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
|
||||||
unsigned long textaccess, unsigned long address)
|
unsigned long address)
|
||||||
{
|
{
|
||||||
struct task_struct *tsk;
|
struct task_struct *tsk;
|
||||||
struct mm_struct *mm;
|
struct mm_struct *mm;
|
||||||
struct vm_area_struct * vma;
|
struct vm_area_struct * vma;
|
||||||
const struct exception_table_entry *fixup;
|
const struct exception_table_entry *fixup;
|
||||||
|
int write = error_code & FAULT_CODE_WRITE;
|
||||||
|
int textaccess = error_code & FAULT_CODE_ITLB;
|
||||||
unsigned int flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
|
unsigned int flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
|
||||||
(writeaccess ? FAULT_FLAG_WRITE : 0));
|
(write ? FAULT_FLAG_WRITE : 0));
|
||||||
pte_t *pte;
|
pte_t *pte;
|
||||||
int fault;
|
int fault;
|
||||||
|
|
||||||
@ -122,7 +124,7 @@ good_area:
|
|||||||
if (!(vma->vm_flags & VM_EXEC))
|
if (!(vma->vm_flags & VM_EXEC))
|
||||||
goto bad_area;
|
goto bad_area;
|
||||||
} else {
|
} else {
|
||||||
if (writeaccess) {
|
if (write) {
|
||||||
if (!(vma->vm_flags & VM_WRITE))
|
if (!(vma->vm_flags & VM_WRITE))
|
||||||
goto bad_area;
|
goto bad_area;
|
||||||
} else {
|
} else {
|
||||||
@ -239,7 +241,7 @@ no_context:
|
|||||||
printk(KERN_ALERT "Unable to handle kernel paging request");
|
printk(KERN_ALERT "Unable to handle kernel paging request");
|
||||||
printk(" at virtual address %08lx\n", address);
|
printk(" at virtual address %08lx\n", address);
|
||||||
printk(KERN_ALERT "pc = %08Lx%08Lx\n", regs->pc >> 32, regs->pc & 0xffffffff);
|
printk(KERN_ALERT "pc = %08Lx%08Lx\n", regs->pc >> 32, regs->pc & 0xffffffff);
|
||||||
die("Oops", regs, writeaccess);
|
die("Oops", regs, error_code);
|
||||||
do_exit(SIGKILL);
|
do_exit(SIGKILL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user