entry.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Definitions used by low-level trap handlers
  3. *
  4. * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
  5. * Copyright (C) 2007-2009 PetaLogix
  6. * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General
  9. * Public License. See the file COPYING in the main directory of this
  10. * archive for more details.
  11. */
  12. #ifndef _ASM_MICROBLAZE_ENTRY_H
  13. #define _ASM_MICROBLAZE_ENTRY_H
  14. #include <asm/percpu.h>
  15. #include <asm/ptrace.h>
  16. /*
  17. * These are per-cpu variables required in entry.S, among other
  18. * places
  19. */
  20. #define PER_CPU(var) per_cpu__##var
  21. # ifndef __ASSEMBLY__
  22. DECLARE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */
  23. DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
  24. DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
  25. DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
  26. DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
  27. # endif /* __ASSEMBLY__ */
  28. #ifndef CONFIG_MMU
  29. /* noMMU hasn't any space for args */
  30. # define STATE_SAVE_ARG_SPACE (0)
  31. #else /* CONFIG_MMU */
  32. /* If true, system calls save and restore all registers (except result
  33. * registers, of course). If false, then `call clobbered' registers
  34. * will not be preserved, on the theory that system calls are basically
  35. * function calls anyway, and the caller should be able to deal with it.
  36. * This is a security risk, of course, as `internal' values may leak out
  37. * after a system call, but that certainly doesn't matter very much for
  38. * a processor with no MMU protection! For a protected-mode kernel, it
  39. * would be faster to just zero those registers before returning.
  40. *
  41. * I can not rely on the glibc implementation. If you turn it off make
  42. * sure that r11/r12 is saved in user-space. --KAA
  43. *
  44. * These are special variables using by the kernel trap/interrupt code
  45. * to save registers in, at a time when there are no spare registers we
  46. * can use to do so, and we can't depend on the value of the stack
  47. * pointer. This means that they must be within a signed 16-bit
  48. * displacement of 0x00000000.
  49. */
  50. /* A `state save frame' is a struct pt_regs preceded by some extra space
  51. * suitable for a function call stack frame. */
  52. /* Amount of room on the stack reserved for arguments and to satisfy the
  53. * C calling conventions, in addition to the space used by the struct
  54. * pt_regs that actually holds saved values. */
  55. #define STATE_SAVE_ARG_SPACE (6*4) /* Up to six arguments */
  56. #endif /* CONFIG_MMU */
  57. #endif /* _ASM_MICROBLAZE_ENTRY_H */