mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-08 22:23:19 +09:00
INIT_THREAD enables interrupts in the thread_struct's saved flags. This means that interrupts get enabled in the middle of context_switch() while switching to new tasks that get forked off the init task during boot. Don't do this. Fixes the following splat on boot with spinlock debugging on: BUG: spinlock cpu recursion on CPU#0, swapper/2 lock: runqueues+0x0/0x47c, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0 CPU: 0 PID: 2 Comm: swapper Not tainted 3.19.0-08796-ga747b55 #285 Call Trace: [<c0032b80>] spin_bug+0x2a/0x36 [<c0032c98>] do_raw_spin_lock+0xa2/0x126 [<c01964b0>] _raw_spin_lock+0x20/0x2a [<c00286c8>] scheduler_tick+0x22/0x76 [<c003db2c>] update_process_times+0x5e/0x72 [<c0007a94>] timer_interrupt+0x4e/0x6a [<c00378d6>] handle_irq_event_percpu+0x54/0xf2 [<c00379c4>] handle_irq_event+0x50/0x74 [<c003988e>] handle_simple_irq+0x6c/0xbe [<c0037270>] generic_handle_irq+0x2a/0x36 [<c0004c40>] do_IRQ+0x38/0x84 [<c000662e>] crisv32_do_IRQ+0x54/0x60 [<c0006204>] IRQ0x4b_interrupt+0x34/0x3c [<c0192baa>] __schedule+0x24a/0x532 [<c00056b4>] ret_from_kernel_thread+0x0/0x14 Signed-off-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Jesper Nilsson <jespern@axis.com>
54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
#ifndef _ASM_CRIS_ARCH_PROCESSOR_H
|
|
#define _ASM_CRIS_ARCH_PROCESSOR_H
|
|
|
|
|
|
/* Return current instruction pointer. */
|
|
#define current_text_addr() \
|
|
({void *pc; __asm__ __volatile__ ("lapcq .,%0" : "=rm" (pc)); pc;})
|
|
|
|
/*
|
|
* Since CRIS doesn't do hardware task-switching this hasn't really anything to
|
|
* do with the proccessor itself, it's just here for legacy reasons. This is
|
|
* used when task-switching using _resume defined in entry.S. The offsets here
|
|
* are hardcoded into _resume, so if this struct is changed, entry.S needs to be
|
|
* changed as well.
|
|
*/
|
|
struct thread_struct {
|
|
unsigned long ksp; /* Kernel stack pointer. */
|
|
unsigned long usp; /* User stack pointer. */
|
|
unsigned long ccs; /* Saved flags register. */
|
|
};
|
|
|
|
/*
|
|
* User-space process size. This is hardcoded into a few places, so don't
|
|
* change it unless everything's clear!
|
|
*/
|
|
#define TASK_SIZE (0xB0000000UL)
|
|
|
|
#define INIT_THREAD { }
|
|
|
|
#define KSTK_EIP(tsk) \
|
|
({ \
|
|
unsigned long eip = 0; \
|
|
unsigned long regs = (unsigned long)task_pt_regs(tsk); \
|
|
if (regs > PAGE_SIZE && virt_addr_valid(regs)) \
|
|
eip = ((struct pt_regs *)regs)->erp; \
|
|
eip; \
|
|
})
|
|
|
|
/*
|
|
* Give the thread a program location, set user-mode and switch user
|
|
* stackpointer.
|
|
*/
|
|
#define start_thread(regs, ip, usp) \
|
|
do { \
|
|
regs->erp = ip; \
|
|
regs->ccs |= 1 << (U_CCS_BITNR + CCS_SHIFT); \
|
|
wrusp(usp); \
|
|
} while(0)
|
|
|
|
/* Nothing special to do for v32 when handling a kernel bus fault fixup. */
|
|
#define arch_fixup(regs) {};
|
|
|
|
#endif /* _ASM_CRIS_ARCH_PROCESSOR_H */
|