2 * linux/arch/unicore32/include/asm/processor.h
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef __UNICORE_PROCESSOR_H__
14 #define __UNICORE_PROCESSOR_H__
17 * Default implementation of macro that returns current
18 * instruction pointer ("program counter").
20 #define current_text_addr() ({ __label__ _l; _l: &&_l; })
24 #include <asm/ptrace.h>
25 #include <asm/types.h>
28 #define STACK_TOP TASK_SIZE
29 #define STACK_TOP_MAX TASK_SIZE
39 struct debug_entry bp[2];
42 struct thread_struct {
44 unsigned long address;
45 unsigned long trap_no;
46 unsigned long error_code;
48 struct debug_info debug;
51 #define INIT_THREAD { }
53 #define start_thread(regs, pc, sp) \
55 unsigned long *stack = (unsigned long *)sp; \
57 memset(regs->uregs, 0, sizeof(regs->uregs)); \
58 regs->UCreg_asr = USER_MODE; \
59 regs->UCreg_pc = pc & ~1; /* pc */ \
60 regs->UCreg_sp = sp; /* sp */ \
61 regs->UCreg_02 = stack[2]; /* r2 (envp) */ \
62 regs->UCreg_01 = stack[1]; /* r1 (argv) */ \
63 regs->UCreg_00 = stack[0]; /* r0 (argc) */ \
66 /* Forward declaration, a strange C thing */
69 /* Free all resources held by a thread. */
70 extern void release_thread(struct task_struct *);
72 /* Prepare to copy thread state - unlazy all lazy status */
73 #define prepare_to_copy(tsk) do { } while (0)
75 unsigned long get_wchan(struct task_struct *p);
77 #define cpu_relax() barrier()
80 * Create a new kernel thread
82 extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
84 #define task_pt_regs(p) \
85 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
87 #define KSTK_EIP(tsk) (task_pt_regs(tsk)->UCreg_pc)
88 #define KSTK_ESP(tsk) (task_pt_regs(tsk)->UCreg_sp)
92 #endif /* __UNICORE_PROCESSOR_H__ */