processor.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * OpenRISC Linux
  4. *
  5. * Linux architectural port borrowing liberally from similar works of
  6. * others. All original copyrights apply as per the original source
  7. * declaration.
  8. *
  9. * OpenRISC implementation:
  10. * Copyright (C) 2003 Matjaz Breskvar <[email protected]>
  11. * Copyright (C) 2010-2011 Jonas Bonn <[email protected]>
  12. * et al.
  13. */
  14. #ifndef __ASM_OPENRISC_PROCESSOR_H
  15. #define __ASM_OPENRISC_PROCESSOR_H
  16. #include <asm/spr_defs.h>
  17. #include <asm/page.h>
  18. #include <asm/ptrace.h>
  19. #define STACK_TOP TASK_SIZE
  20. #define STACK_TOP_MAX STACK_TOP
  21. /* Kernel and user SR register setting */
  22. #define KERNEL_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \
  23. | SPR_SR_DCE | SPR_SR_SM)
  24. #define USER_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \
  25. | SPR_SR_DCE | SPR_SR_IEE | SPR_SR_TEE)
  26. /*
  27. * User space process size. This is hardcoded into a few places,
  28. * so don't change it unless you know what you are doing.
  29. */
  30. #define TASK_SIZE (0x80000000UL)
  31. /* This decides where the kernel will search for a free chunk of vm
  32. * space during mmap's.
  33. */
  34. #define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
  35. #ifndef __ASSEMBLY__
  36. struct task_struct;
  37. struct thread_struct {
  38. };
  39. /*
  40. * At user->kernel entry, the pt_regs struct is stacked on the top of the
  41. * kernel-stack. This macro allows us to find those regs for a task.
  42. * Notice that subsequent pt_regs stackings, like recursive interrupts
  43. * occurring while we're in the kernel, won't affect this - only the first
  44. * user->kernel transition registers are reached by this (i.e. not regs
  45. * for running signal handler)
  46. */
  47. #define user_regs(thread_info) (((struct pt_regs *)((unsigned long)(thread_info) + THREAD_SIZE - STACK_FRAME_OVERHEAD)) - 1)
  48. /*
  49. * Dito but for the currently running task
  50. */
  51. #define task_pt_regs(task) user_regs(task_thread_info(task))
  52. #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
  53. #define INIT_THREAD { }
  54. #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
  55. #define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp)
  56. void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
  57. unsigned long __get_wchan(struct task_struct *p);
  58. #define cpu_relax() barrier()
  59. #endif /* __ASSEMBLY__ */
  60. #endif /* __ASM_OPENRISC_PROCESSOR_H */