powerpc: bad_page_fault get registers from regs

Similar to the previous patch this makes interrupt handler function
types more regular so they can be wrapped with the next patch.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210130130852.2952424-12-npiggin@gmail.com
This commit is contained in:
Nicholas Piggin 2021-01-30 23:08:21 +10:00 коммит произвёл Michael Ellerman
Родитель 73d7a97914
Коммит 8458c628a5
8 изменённых файлов: 12 добавлений и 14 удалений

Просмотреть файл

@ -112,8 +112,8 @@
struct pt_regs; struct pt_regs;
long do_page_fault(struct pt_regs *); long do_page_fault(struct pt_regs *);
extern void bad_page_fault(struct pt_regs *, unsigned long, int); void bad_page_fault(struct pt_regs *, int);
void __bad_page_fault(struct pt_regs *regs, unsigned long address, int sig); void __bad_page_fault(struct pt_regs *regs, int sig);
extern void _exception(int, struct pt_regs *, int, unsigned long); extern void _exception(int, struct pt_regs *, int, unsigned long);
extern void _exception_pkey(struct pt_regs *, unsigned long, int); extern void _exception_pkey(struct pt_regs *, unsigned long, int);
extern void die(const char *, struct pt_regs *, long); extern void die(const char *, struct pt_regs *, long);

Просмотреть файл

@ -672,9 +672,8 @@ handle_page_fault:
lwz r0,_TRAP(r1) lwz r0,_TRAP(r1)
clrrwi r0,r0,1 clrrwi r0,r0,1
stw r0,_TRAP(r1) stw r0,_TRAP(r1)
mr r5,r3 mr r4,r3 /* err arg for bad_page_fault */
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
lwz r4,_DAR(r1)
bl __bad_page_fault bl __bad_page_fault
b ret_from_except_full b ret_from_except_full

Просмотреть файл

@ -1016,9 +1016,8 @@ storage_fault_common:
bne- 1f bne- 1f
b ret_from_except_lite b ret_from_except_lite
1: bl save_nvgprs 1: bl save_nvgprs
mr r5,r3 mr r4,r3
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
ld r4,_DAR(r1)
bl __bad_page_fault bl __bad_page_fault
b ret_from_except b ret_from_except

Просмотреть файл

@ -1612,7 +1612,7 @@ bad:
if (user_mode(regs)) if (user_mode(regs))
_exception(sig, regs, code, regs->dar); _exception(sig, regs, code, regs->dar);
else else
bad_page_fault(regs, regs->dar, sig); bad_page_fault(regs, sig);
bail: bail:
exception_exit(prev_state); exception_exit(prev_state);

Просмотреть файл

@ -1539,7 +1539,7 @@ long do_hash_fault(struct pt_regs *regs)
* the access, or panic if there isn't a handler. * the access, or panic if there isn't a handler.
*/ */
if (unlikely(in_nmi())) { if (unlikely(in_nmi())) {
bad_page_fault(regs, ea, SIGSEGV); bad_page_fault(regs, SIGSEGV);
return 0; return 0;
} }
@ -1578,7 +1578,7 @@ long do_hash_fault(struct pt_regs *regs)
else else
_exception(SIGBUS, regs, BUS_ADRERR, ea); _exception(SIGBUS, regs, BUS_ADRERR, ea);
} else { } else {
bad_page_fault(regs, ea, SIGBUS); bad_page_fault(regs, SIGBUS);
} }
err = 0; err = 0;

Просмотреть файл

@ -874,7 +874,7 @@ void do_bad_slb_fault(struct pt_regs *regs)
if (user_mode(regs)) if (user_mode(regs))
_exception(SIGSEGV, regs, SEGV_BNDERR, regs->dar); _exception(SIGSEGV, regs, SEGV_BNDERR, regs->dar);
else else
bad_page_fault(regs, regs->dar, SIGSEGV); bad_page_fault(regs, SIGSEGV);
} else if (err == -EINVAL) { } else if (err == -EINVAL) {
unrecoverable_exception(regs); unrecoverable_exception(regs);
} else { } else {

Просмотреть файл

@ -566,7 +566,7 @@ NOKPROBE_SYMBOL(do_page_fault);
* It is called from the DSI and ISI handlers in head.S and from some * It is called from the DSI and ISI handlers in head.S and from some
* of the procedures in traps.c. * of the procedures in traps.c.
*/ */
void __bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) void __bad_page_fault(struct pt_regs *regs, int sig)
{ {
int is_write = page_fault_is_write(regs->dsisr); int is_write = page_fault_is_write(regs->dsisr);
@ -604,7 +604,7 @@ void __bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
die("Kernel access of bad area", regs, sig); die("Kernel access of bad area", regs, sig);
} }
void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) void bad_page_fault(struct pt_regs *regs, int sig)
{ {
const struct exception_table_entry *entry; const struct exception_table_entry *entry;
@ -613,5 +613,5 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
if (entry) if (entry)
instruction_pointer_set(regs, extable_fixup(entry)); instruction_pointer_set(regs, extable_fixup(entry));
else else
__bad_page_fault(regs, address, sig); __bad_page_fault(regs, sig);
} }

Просмотреть файл

@ -26,7 +26,7 @@ int machine_check_8xx(struct pt_regs *regs)
* to deal with that than having a wart in the mcheck handler. * to deal with that than having a wart in the mcheck handler.
* -- BenH * -- BenH
*/ */
bad_page_fault(regs, regs->dar, SIGBUS); bad_page_fault(regs, SIGBUS);
return 1; return 1;
#else #else
return 0; return 0;