Commit 38a7cfbf authored by Hirokazu Takata's avatar Hirokazu Takata Committed by Linus Torvalds

[PATCH] m32r: Don't encode ACE_INSTRUCTION in address

- To be more comprehensive, keep ACE_INSTRUCTION (access exception
  on instruction execution) information in thread_info->flags,
  instead of encoding it into address parameter.
Signed-off-by: default avatarNIIBE Yutaka <gniibe@fsij.org>
Signed-off-by: default avatarHirokazu Takata <takata@linux-m32r.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 295b7366
...@@ -222,7 +222,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, ...@@ -222,7 +222,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
* make sure we exit gracefully rather than endlessly redo * make sure we exit gracefully rather than endlessly redo
* the fault. * the fault.
*/ */
addr = (address & PAGE_MASK) | (error_code & ACE_INSTRUCTION); addr = (address & PAGE_MASK);
set_thread_fault_code(error_code);
switch (handle_mm_fault(mm, vma, addr, write)) { switch (handle_mm_fault(mm, vma, addr, write)) {
case VM_FAULT_MINOR: case VM_FAULT_MINOR:
tsk->min_flt++; tsk->min_flt++;
...@@ -237,7 +238,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, ...@@ -237,7 +238,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
default: default:
BUG(); BUG();
} }
set_thread_fault_code(0);
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
return; return;
...@@ -381,7 +382,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr, ...@@ -381,7 +382,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr,
unsigned long *entry1, *entry2; unsigned long *entry1, *entry2;
unsigned long pte_data, flags; unsigned long pte_data, flags;
unsigned int *entry_dat; unsigned int *entry_dat;
int inst = vaddr & 8; int inst = get_thread_fault_code() & ACE_INSTRUCTION;
int i; int i;
/* Ptrace may call this routine. */ /* Ptrace may call this routine. */
......
...@@ -99,6 +99,21 @@ static inline struct thread_info *current_thread_info(void) ...@@ -99,6 +99,21 @@ static inline struct thread_info *current_thread_info(void)
#define get_thread_info(ti) get_task_struct((ti)->task) #define get_thread_info(ti) get_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->task) #define put_thread_info(ti) put_task_struct((ti)->task)
#define TI_FLAG_FAULT_CODE_SHIFT 28
static inline void set_thread_fault_code(unsigned int val)
{
struct thread_info *ti = current_thread_info();
ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT)))
| (val << TI_FLAG_FAULT_CODE_SHIFT);
}
static inline unsigned int get_thread_fault_code(void)
{
struct thread_info *ti = current_thread_info();
return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT;
}
#else /* !__ASSEMBLY__ */ #else /* !__ASSEMBLY__ */
/* how to get the thread information struct from ASM */ /* how to get the thread information struct from ASM */
...@@ -123,6 +138,7 @@ static inline struct thread_info *current_thread_info(void) ...@@ -123,6 +138,7 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
#define TIF_IRET 5 /* return with iret */ #define TIF_IRET 5 /* return with iret */
#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
/* 31..28 fault code */
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment