Skip to content

Commit 10d4339

Browse files
committed
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
2 parents fd008d1 + ecae26f commit 10d4339

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

arch/xtensa/include/asm/processor.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,18 @@ struct thread_struct {
187187

188188
/* Clearing a0 terminates the backtrace. */
189189
#define start_thread(regs, new_pc, new_sp) \
190-
memset(regs, 0, sizeof(*regs)); \
191-
regs->pc = new_pc; \
192-
regs->ps = USER_PS_VALUE; \
193-
regs->areg[1] = new_sp; \
194-
regs->areg[0] = 0; \
195-
regs->wmask = 1; \
196-
regs->depc = 0; \
197-
regs->windowbase = 0; \
198-
regs->windowstart = 1;
190+
do { \
191+
memset((regs), 0, sizeof(*(regs))); \
192+
(regs)->pc = (new_pc); \
193+
(regs)->ps = USER_PS_VALUE; \
194+
(regs)->areg[1] = (new_sp); \
195+
(regs)->areg[0] = 0; \
196+
(regs)->wmask = 1; \
197+
(regs)->depc = 0; \
198+
(regs)->windowbase = 0; \
199+
(regs)->windowstart = 1; \
200+
(regs)->syscall = NO_SYSCALL; \
201+
} while (0)
199202

200203
/* Forward declaration */
201204
struct task_struct;

arch/xtensa/kernel/entry.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,8 @@ ENTRY(system_call)
18601860
l32i a7, a2, PT_SYSCALL
18611861

18621862
1:
1863+
s32i a7, a1, 4
1864+
18631865
/* syscall = sys_call_table[syscall_nr] */
18641866

18651867
movi a4, sys_call_table
@@ -1893,8 +1895,12 @@ ENTRY(system_call)
18931895
retw
18941896

18951897
1:
1898+
l32i a4, a1, 4
1899+
l32i a3, a2, PT_SYSCALL
1900+
s32i a4, a2, PT_SYSCALL
18961901
mov a6, a2
18971902
call4 do_syscall_trace_leave
1903+
s32i a3, a2, PT_SYSCALL
18981904
retw
18991905

19001906
ENDPROC(system_call)

arch/xtensa/kernel/stacktrace.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,14 @@ static int return_address_cb(struct stackframe *frame, void *data)
253253
return 1;
254254
}
255255

256+
/*
257+
* level == 0 is for the return address from the caller of this function,
258+
* not from this function itself.
259+
*/
256260
unsigned long return_address(unsigned level)
257261
{
258262
struct return_addr_data r = {
259-
.skip = level + 1,
263+
.skip = level,
260264
};
261265
walk_stackframe(stack_pointer(NULL), return_address_cb, &r);
262266
return r.addr;

arch/xtensa/mm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages)
3333

3434
pte = memblock_alloc_low(n_pages * sizeof(pte_t), PAGE_SIZE);
3535
if (!pte)
36-
panic("%s: Failed to allocate %zu bytes align=%lx\n",
36+
panic("%s: Failed to allocate %lu bytes align=%lx\n",
3737
__func__, n_pages * sizeof(pte_t), PAGE_SIZE);
3838

3939
for (i = 0; i < n_pages; ++i)

0 commit comments

Comments
 (0)