head_32.h 3.5 KB

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