head.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* $Id: head.h,v 1.39 2000/05/26 22:18:45 ecd Exp $ */
  2. #ifndef __SPARC_HEAD_H
  3. #define __SPARC_HEAD_H
  4. #define KERNBASE 0xf0000000 /* First address the kernel will eventually be */
  5. #define LOAD_ADDR 0x4000 /* prom jumps to us here unless this is elf /boot */
  6. #define SUN4C_SEGSZ (1 << 18)
  7. #define SRMMU_L1_KBASE_OFFSET ((KERNBASE>>24)<<2) /* Used in boot remapping. */
  8. #define INTS_ENAB 0x01 /* entry.S uses this. */
  9. #define SUN4_PROM_VECTOR 0xFFE81000 /* SUN4 PROM needs to be hardwired */
  10. #define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */
  11. #define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */
  12. /* Here are some trap goodies */
  13. /* Generic trap entry. */
  14. #define TRAP_ENTRY(type, label) \
  15. rd %psr, %l0; b label; rd %wim, %l3; nop;
  16. /* Data/text faults. Defaults to sun4c version at boot time. */
  17. #define SPARC_TFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 1, %l7;
  18. #define SPARC_DFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 0, %l7;
  19. #define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 1, %l7;
  20. #define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 0, %l7;
  21. /* This is for traps we should NEVER get. */
  22. #define BAD_TRAP(num) \
  23. rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
  24. /* This is for traps when we want just skip the instruction which caused it */
  25. #define SKIP_TRAP(type, name) \
  26. jmpl %l2, %g0; rett %l2 + 4; nop; nop;
  27. /* Notice that for the system calls we pull a trick. We load up a
  28. * different pointer to the system call vector table in %l7, but call
  29. * the same generic system call low-level entry point. The trap table
  30. * entry sequences are also HyperSparc pipeline friendly ;-)
  31. */
  32. /* Software trap for Linux system calls. */
  33. #define LINUX_SYSCALL_TRAP \
  34. sethi %hi(sys_call_table), %l7; \
  35. or %l7, %lo(sys_call_table), %l7; \
  36. b linux_sparc_syscall; \
  37. rd %psr, %l0;
  38. /* Software trap for SunOS4.1.x system calls. */
  39. #define SUNOS_SYSCALL_TRAP \
  40. rd %psr, %l0; \
  41. sethi %hi(sunos_sys_table), %l7; \
  42. b linux_sparc_syscall; \
  43. or %l7, %lo(sunos_sys_table), %l7;
  44. #define SUNOS_NO_SYSCALL_TRAP \
  45. b sunos_syscall; \
  46. rd %psr, %l0; \
  47. nop; \
  48. nop;
  49. /* Software trap for Slowaris system calls. */
  50. #define SOLARIS_SYSCALL_TRAP \
  51. b solaris_syscall; \
  52. rd %psr, %l0; \
  53. nop; \
  54. nop;
  55. #define INDIRECT_SOLARIS_SYSCALL(x) \
  56. mov x, %g1; \
  57. b solaris_syscall; \
  58. rd %psr, %l0; \
  59. nop;
  60. #define BREAKPOINT_TRAP \
  61. b breakpoint_trap; \
  62. rd %psr,%l0; \
  63. nop; \
  64. nop;
  65. /* Software trap for Sparc-netbsd system calls. */
  66. #define NETBSD_SYSCALL_TRAP \
  67. sethi %hi(sys_call_table), %l7; \
  68. or %l7, %lo(sys_call_table), %l7; \
  69. b bsd_syscall; \
  70. rd %psr, %l0;
  71. /* The Get Condition Codes software trap for userland. */
  72. #define GETCC_TRAP \
  73. b getcc_trap_handler; mov %psr, %l0; nop; nop;
  74. /* The Set Condition Codes software trap for userland. */
  75. #define SETCC_TRAP \
  76. b setcc_trap_handler; mov %psr, %l0; nop; nop;
  77. /* The Get PSR software trap for userland. */
  78. #define GETPSR_TRAP \
  79. mov %psr, %i0; jmp %l2; rett %l2 + 4; nop;
  80. /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
  81. * gets handled with another macro.
  82. */
  83. #define TRAP_ENTRY_INTERRUPT(int_level) \
  84. mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
  85. /* NMI's (Non Maskable Interrupts) are special, you can't keep them
  86. * from coming in, and basically if you get one, the shows over. ;(
  87. * On the sun4c they are usually asynchronous memory errors, on the
  88. * the sun4m they could be either due to mem errors or a software
  89. * initiated interrupt from the prom/kern on an SMP box saying "I
  90. * command you to do CPU tricks, read your mailbox for more info."
  91. */
  92. #define NMI_TRAP \
  93. rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
  94. /* Window overflows/underflows are special and we need to try to be as
  95. * efficient as possible here....
  96. */
  97. #define WINDOW_SPILL \
  98. rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0;
  99. #define WINDOW_FILL \
  100. rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0;
  101. #endif /* __SPARC_HEAD_H */