at v5.1 77 lines 1.9 kB view raw
1/* 2 * linux/arch/unicore32/include/asm/processor.h 3 * 4 * Code specific to PKUnity SoC and UniCore ISA 5 * 6 * Copyright (C) 2001-2010 GUAN Xue-tao 7 * 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. 11 */ 12 13#ifndef __UNICORE_PROCESSOR_H__ 14#define __UNICORE_PROCESSOR_H__ 15 16#ifdef __KERNEL__ 17 18#include <asm/ptrace.h> 19#include <asm/types.h> 20 21#ifdef __KERNEL__ 22#define STACK_TOP TASK_SIZE 23#define STACK_TOP_MAX TASK_SIZE 24#endif 25 26struct debug_entry { 27 u32 address; 28 u32 insn; 29}; 30 31struct debug_info { 32 int nsaved; 33 struct debug_entry bp[2]; 34}; 35 36struct thread_struct { 37 /* fault info */ 38 unsigned long address; 39 unsigned long trap_no; 40 unsigned long error_code; 41 /* debugging */ 42 struct debug_info debug; 43}; 44 45#define INIT_THREAD { } 46 47#define start_thread(regs, pc, sp) \ 48({ \ 49 unsigned long *stack = (unsigned long *)sp; \ 50 memset(regs->uregs, 0, sizeof(regs->uregs)); \ 51 regs->UCreg_asr = USER_MODE; \ 52 regs->UCreg_pc = pc & ~1; /* pc */ \ 53 regs->UCreg_sp = sp; /* sp */ \ 54 regs->UCreg_02 = stack[2]; /* r2 (envp) */ \ 55 regs->UCreg_01 = stack[1]; /* r1 (argv) */ \ 56 regs->UCreg_00 = stack[0]; /* r0 (argc) */ \ 57}) 58 59/* Forward declaration, a strange C thing */ 60struct task_struct; 61 62/* Free all resources held by a thread. */ 63extern void release_thread(struct task_struct *); 64 65unsigned long get_wchan(struct task_struct *p); 66 67#define cpu_relax() barrier() 68 69#define task_pt_regs(p) \ 70 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) 71 72#define KSTK_EIP(tsk) (task_pt_regs(tsk)->UCreg_pc) 73#define KSTK_ESP(tsk) (task_pt_regs(tsk)->UCreg_sp) 74 75#endif 76 77#endif /* __UNICORE_PROCESSOR_H__ */