head_32.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __SPARC_HEAD_H
  3. #define __SPARC_HEAD_H
  4. #define KERNBASE 0xf0000000 /* First address the kernel will eventually be */
  5. #define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */
  6. /* Here are some trap goodies */
  7. /* Generic trap entry. */
  8. #define TRAP_ENTRY(type, label) \
  9. rd %psr, %l0; b label; rd %wim, %l3; nop;
  10. /* Data/text faults */
  11. #define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 1, %l7;
  12. #define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 0, %l7;
  13. /* This is for traps we should NEVER get. */
  14. #define BAD_TRAP(num) \
  15. rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
  16. /* This is for traps when we want just skip the instruction which caused it */
  17. #define SKIP_TRAP(type, name) \
  18. jmpl %l2, %g0; rett %l2 + 4; nop; nop;
  19. /* Notice that for the system calls we pull a trick. We load up a
  20. * different pointer to the system call vector table in %l7, but call
  21. * the same generic system call low-level entry point. The trap table
  22. * entry sequences are also HyperSparc pipeline friendly ;-)
  23. */
  24. /* Software trap for Linux system calls. */
  25. #define LINUX_SYSCALL_TRAP \
  26. sethi %hi(sys_call_table), %l7; \
  27. or %l7, %lo(sys_call_table), %l7; \
  28. b linux_sparc_syscall; \
  29. rd %psr, %l0;
  30. #define BREAKPOINT_TRAP \
  31. b breakpoint_trap; \
  32. rd %psr,%l0; \
  33. nop; \
  34. nop;
  35. #ifdef CONFIG_KGDB
  36. #define KGDB_TRAP(num) \
  37. mov num, %l7; \
  38. b kgdb_trap_low; \
  39. rd %psr,%l0; \
  40. nop;
  41. #else
  42. #define KGDB_TRAP(num) \
  43. BAD_TRAP(num)
  44. #endif
  45. /* The Get Condition Codes software trap for userland. */
  46. #define GETCC_TRAP \
  47. b getcc_trap_handler; rd %psr, %l0; nop; nop;
  48. /* The Set Condition Codes software trap for userland. */
  49. #define SETCC_TRAP \
  50. b setcc_trap_handler; rd %psr, %l0; nop; nop;
  51. /* The Get PSR software trap for userland. */
  52. #define GETPSR_TRAP \
  53. rd %psr, %i0; jmp %l2; rett %l2 + 4; nop;
  54. /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
  55. * gets handled with another macro.
  56. */
  57. #define TRAP_ENTRY_INTERRUPT(int_level) \
  58. mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
  59. /* Window overflows/underflows are special and we need to try to be as
  60. * efficient as possible here....
  61. */
  62. #define WINDOW_SPILL \
  63. rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0;
  64. #define WINDOW_FILL \
  65. rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0;
  66. #endif /* __SPARC_HEAD_H */