root/arch/unicore32/include/asm/processor.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


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

/* [<][>][^][v][top][bottom][index][help] */