vsyscall-sysenter.S 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Code for the vsyscall page. This version uses the sysenter instruction.
  3. */
  4. #include <asm/ia32_unistd.h>
  5. #include <asm/asm-offsets.h>
  6. .code32
  7. .text
  8. .section .text.vsyscall,"ax"
  9. .globl __kernel_vsyscall
  10. .type __kernel_vsyscall,@function
  11. __kernel_vsyscall:
  12. .LSTART_vsyscall:
  13. push %ecx
  14. .Lpush_ecx:
  15. push %edx
  16. .Lpush_edx:
  17. push %ebp
  18. .Lenter_kernel:
  19. movl %esp,%ebp
  20. sysenter
  21. .space 7,0x90
  22. jmp .Lenter_kernel
  23. /* 16: System call normal return point is here! */
  24. pop %ebp
  25. .Lpop_ebp:
  26. pop %edx
  27. .Lpop_edx:
  28. pop %ecx
  29. .Lpop_ecx:
  30. ret
  31. .LEND_vsyscall:
  32. .size __kernel_vsyscall,.-.LSTART_vsyscall
  33. .section .eh_frame,"a",@progbits
  34. .LSTARTFRAME:
  35. .long .LENDCIE-.LSTARTCIE
  36. .LSTARTCIE:
  37. .long 0 /* CIE ID */
  38. .byte 1 /* Version number */
  39. .string "zR" /* NUL-terminated augmentation string */
  40. .uleb128 1 /* Code alignment factor */
  41. .sleb128 -4 /* Data alignment factor */
  42. .byte 8 /* Return address register column */
  43. .uleb128 1 /* Augmentation value length */
  44. .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
  45. .byte 0x0c /* DW_CFA_def_cfa */
  46. .uleb128 4
  47. .uleb128 4
  48. .byte 0x88 /* DW_CFA_offset, column 0x8 */
  49. .uleb128 1
  50. .align 4
  51. .LENDCIE:
  52. .long .LENDFDE1-.LSTARTFDE1 /* Length FDE */
  53. .LSTARTFDE1:
  54. .long .LSTARTFDE1-.LSTARTFRAME /* CIE pointer */
  55. .long .LSTART_vsyscall-. /* PC-relative start address */
  56. .long .LEND_vsyscall-.LSTART_vsyscall
  57. .uleb128 0 /* Augmentation length */
  58. /* What follows are the instructions for the table generation.
  59. We have to record all changes of the stack pointer. */
  60. .byte 0x04 /* DW_CFA_advance_loc4 */
  61. .long .Lpush_ecx-.LSTART_vsyscall
  62. .byte 0x0e /* DW_CFA_def_cfa_offset */
  63. .byte 0x08 /* RA at offset 8 now */
  64. .byte 0x04 /* DW_CFA_advance_loc4 */
  65. .long .Lpush_edx-.Lpush_ecx
  66. .byte 0x0e /* DW_CFA_def_cfa_offset */
  67. .byte 0x0c /* RA at offset 12 now */
  68. .byte 0x04 /* DW_CFA_advance_loc4 */
  69. .long .Lenter_kernel-.Lpush_edx
  70. .byte 0x0e /* DW_CFA_def_cfa_offset */
  71. .byte 0x10 /* RA at offset 16 now */
  72. .byte 0x85, 0x04 /* DW_CFA_offset %ebp -16 */
  73. /* Finally the epilogue. */
  74. .byte 0x04 /* DW_CFA_advance_loc4 */
  75. .long .Lpop_ebp-.Lenter_kernel
  76. .byte 0x0e /* DW_CFA_def_cfa_offset */
  77. .byte 0x12 /* RA at offset 12 now */
  78. .byte 0xc5 /* DW_CFA_restore %ebp */
  79. .byte 0x04 /* DW_CFA_advance_loc4 */
  80. .long .Lpop_edx-.Lpop_ebp
  81. .byte 0x0e /* DW_CFA_def_cfa_offset */
  82. .byte 0x08 /* RA at offset 8 now */
  83. .byte 0x04 /* DW_CFA_advance_loc4 */
  84. .long .Lpop_ecx-.Lpop_edx
  85. .byte 0x0e /* DW_CFA_def_cfa_offset */
  86. .byte 0x04 /* RA at offset 4 now */
  87. .align 4
  88. .LENDFDE1:
  89. #define SYSCALL_ENTER_KERNEL int $0x80
  90. #include "vsyscall-sigreturn.S"