processor.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2008-2009 Michal Simek <[email protected]>
  4. * Copyright (C) 2008-2009 PetaLogix
  5. * Copyright (C) 2006 Atmark Techno, Inc.
  6. */
  7. #ifndef _ASM_MICROBLAZE_PROCESSOR_H
  8. #define _ASM_MICROBLAZE_PROCESSOR_H
  9. #include <asm/ptrace.h>
  10. #include <asm/setup.h>
  11. #include <asm/registers.h>
  12. #include <asm/entry.h>
  13. #include <asm/current.h>
  14. # ifndef __ASSEMBLY__
  15. /* from kernel/cpu/mb.c */
  16. extern const struct seq_operations cpuinfo_op;
  17. # define cpu_relax() barrier()
  18. #define task_pt_regs(tsk) \
  19. (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
  20. /* Do necessary setup to start up a newly executed thread. */
  21. void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp);
  22. extern void ret_from_fork(void);
  23. extern void ret_from_kernel_thread(void);
  24. # endif /* __ASSEMBLY__ */
  25. /*
  26. * This is used to define STACK_TOP, and with MMU it must be below
  27. * kernel base to select the correct PGD when handling MMU exceptions.
  28. */
  29. # define TASK_SIZE (CONFIG_KERNEL_START)
  30. /*
  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. # define THREAD_KSP 0
  36. # ifndef __ASSEMBLY__
  37. /* If you change this, you must change the associated assembly-languages
  38. * constants defined below, THREAD_*.
  39. */
  40. struct thread_struct {
  41. /* kernel stack pointer (must be first field in structure) */
  42. unsigned long ksp;
  43. unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */
  44. void *pgdir; /* root of page-table tree */
  45. struct pt_regs *regs; /* Pointer to saved register state */
  46. };
  47. # define INIT_THREAD { \
  48. .ksp = sizeof init_stack + (unsigned long)init_stack, \
  49. .pgdir = swapper_pg_dir, \
  50. }
  51. unsigned long __get_wchan(struct task_struct *p);
  52. /* The size allocated for kernel stacks. This _must_ be a power of two! */
  53. # define KERNEL_STACK_SIZE 0x2000
  54. /* Return some info about the user process TASK. */
  55. # define task_tos(task) ((unsigned long)(task) + KERNEL_STACK_SIZE)
  56. # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1)
  57. # define task_pt_regs_plus_args(tsk) \
  58. ((void *)task_pt_regs(tsk))
  59. # define task_sp(task) (task_regs(task)->r1)
  60. # define task_pc(task) (task_regs(task)->pc)
  61. /* Grotty old names for some. */
  62. # define KSTK_EIP(task) (task_pc(task))
  63. # define KSTK_ESP(task) (task_sp(task))
  64. # define STACK_TOP TASK_SIZE
  65. # define STACK_TOP_MAX STACK_TOP
  66. #ifdef CONFIG_DEBUG_FS
  67. extern struct dentry *of_debugfs_root;
  68. #endif
  69. # endif /* __ASSEMBLY__ */
  70. #endif /* _ASM_MICROBLAZE_PROCESSOR_H */