Commit 10d43397 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'xtensa-20190408' of git://github.com/jcmvbkbc/linux-xtensa

Pull xtensa fixes from Max Filippov:

 - fix syscall number passed to trace_sys_exit

 - fix syscall number initialization in start_thread

 - fix level interpretation in the return_address

 - fix format string warning in init_pmd

* tag 'xtensa-20190408' of git://github.com/jcmvbkbc/linux-xtensa:
  xtensa: fix format string warning in init_pmd
  xtensa: fix return_address
  xtensa: fix initialization of pt_regs::syscall in start_thread
  xtensa: use actual syscall number in do_syscall_trace_leave
parents fd008d1a ecae26fa
...@@ -187,15 +187,18 @@ struct thread_struct { ...@@ -187,15 +187,18 @@ struct thread_struct {
/* Clearing a0 terminates the backtrace. */ /* Clearing a0 terminates the backtrace. */
#define start_thread(regs, new_pc, new_sp) \ #define start_thread(regs, new_pc, new_sp) \
memset(regs, 0, sizeof(*regs)); \ do { \
regs->pc = new_pc; \ memset((regs), 0, sizeof(*(regs))); \
regs->ps = USER_PS_VALUE; \ (regs)->pc = (new_pc); \
regs->areg[1] = new_sp; \ (regs)->ps = USER_PS_VALUE; \
regs->areg[0] = 0; \ (regs)->areg[1] = (new_sp); \
regs->wmask = 1; \ (regs)->areg[0] = 0; \
regs->depc = 0; \ (regs)->wmask = 1; \
regs->windowbase = 0; \ (regs)->depc = 0; \
regs->windowstart = 1; (regs)->windowbase = 0; \
(regs)->windowstart = 1; \
(regs)->syscall = NO_SYSCALL; \
} while (0)
/* Forward declaration */ /* Forward declaration */
struct task_struct; struct task_struct;
......
...@@ -1860,6 +1860,8 @@ ENTRY(system_call) ...@@ -1860,6 +1860,8 @@ ENTRY(system_call)
l32i a7, a2, PT_SYSCALL l32i a7, a2, PT_SYSCALL
1: 1:
s32i a7, a1, 4
/* syscall = sys_call_table[syscall_nr] */ /* syscall = sys_call_table[syscall_nr] */
movi a4, sys_call_table movi a4, sys_call_table
...@@ -1893,8 +1895,12 @@ ENTRY(system_call) ...@@ -1893,8 +1895,12 @@ ENTRY(system_call)
retw retw
1: 1:
l32i a4, a1, 4
l32i a3, a2, PT_SYSCALL
s32i a4, a2, PT_SYSCALL
mov a6, a2 mov a6, a2
call4 do_syscall_trace_leave call4 do_syscall_trace_leave
s32i a3, a2, PT_SYSCALL
retw retw
ENDPROC(system_call) ENDPROC(system_call)
......
...@@ -253,10 +253,14 @@ static int return_address_cb(struct stackframe *frame, void *data) ...@@ -253,10 +253,14 @@ static int return_address_cb(struct stackframe *frame, void *data)
return 1; return 1;
} }
/*
* level == 0 is for the return address from the caller of this function,
* not from this function itself.
*/
unsigned long return_address(unsigned level) unsigned long return_address(unsigned level)
{ {
struct return_addr_data r = { struct return_addr_data r = {
.skip = level + 1, .skip = level,
}; };
walk_stackframe(stack_pointer(NULL), return_address_cb, &r); walk_stackframe(stack_pointer(NULL), return_address_cb, &r);
return r.addr; return r.addr;
......
...@@ -33,7 +33,7 @@ static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages) ...@@ -33,7 +33,7 @@ static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages)
pte = memblock_alloc_low(n_pages * sizeof(pte_t), PAGE_SIZE); pte = memblock_alloc_low(n_pages * sizeof(pte_t), PAGE_SIZE);
if (!pte) if (!pte)
panic("%s: Failed to allocate %zu bytes align=%lx\n", panic("%s: Failed to allocate %lu bytes align=%lx\n",
__func__, n_pages * sizeof(pte_t), PAGE_SIZE); __func__, n_pages * sizeof(pte_t), PAGE_SIZE);
for (i = 0; i < n_pages; ++i) for (i = 0; i < n_pages; ++i)
......
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