Path: blob/master/arch/unicore32/include/asm/processor.h
10818 views
/*1* linux/arch/unicore32/include/asm/processor.h2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/1112#ifndef __UNICORE_PROCESSOR_H__13#define __UNICORE_PROCESSOR_H__1415/*16* Default implementation of macro that returns current17* instruction pointer ("program counter").18*/19#define current_text_addr() ({ __label__ _l; _l: &&_l; })2021#ifdef __KERNEL__2223#include <asm/ptrace.h>24#include <asm/types.h>2526#ifdef __KERNEL__27#define STACK_TOP TASK_SIZE28#define STACK_TOP_MAX TASK_SIZE29#endif3031struct debug_entry {32u32 address;33u32 insn;34};3536struct debug_info {37int nsaved;38struct debug_entry bp[2];39};4041struct thread_struct {42/* fault info */43unsigned long address;44unsigned long trap_no;45unsigned long error_code;46/* debugging */47struct debug_info debug;48};4950#define INIT_THREAD { }5152#define start_thread(regs, pc, sp) \53({ \54unsigned long *stack = (unsigned long *)sp; \55set_fs(USER_DS); \56memset(regs->uregs, 0, sizeof(regs->uregs)); \57regs->UCreg_asr = USER_MODE; \58regs->UCreg_pc = pc & ~1; /* pc */ \59regs->UCreg_sp = sp; /* sp */ \60regs->UCreg_02 = stack[2]; /* r2 (envp) */ \61regs->UCreg_01 = stack[1]; /* r1 (argv) */ \62regs->UCreg_00 = stack[0]; /* r0 (argc) */ \63})6465/* Forward declaration, a strange C thing */66struct task_struct;6768/* Free all resources held by a thread. */69extern void release_thread(struct task_struct *);7071/* Prepare to copy thread state - unlazy all lazy status */72#define prepare_to_copy(tsk) do { } while (0)7374unsigned long get_wchan(struct task_struct *p);7576#define cpu_relax() barrier()7778/*79* Create a new kernel thread80*/81extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);8283#define task_pt_regs(p) \84((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)8586#define KSTK_EIP(tsk) (task_pt_regs(tsk)->UCreg_pc)87#define KSTK_ESP(tsk) (task_pt_regs(tsk)->UCreg_sp)8889#endif9091#endif /* __UNICORE_PROCESSOR_H__ */929394