1
0

test-i386-vm86.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. .code16
  2. .globl vm86_code_start
  3. .globl vm86_code_end
  4. #define GET_OFFSET(x) ((x) - vm86_code_start + 0x100)
  5. vm86_code_start:
  6. movw $GET_OFFSET(hello_world), %dx
  7. movb $0x09, %ah
  8. int $0x21
  9. /* prepare int 0x90 vector */
  10. xorw %ax, %ax
  11. movw %ax, %es
  12. es movw $GET_OFFSET(int90_test), 0x90 * 4
  13. es movw %cs, 0x90 * 4 + 2
  14. /* launch int 0x90 */
  15. int $0x90
  16. /* test IF support */
  17. movw $GET_OFFSET(IF_msg), %dx
  18. movb $0x09, %ah
  19. int $0x21
  20. pushf
  21. popw %dx
  22. movb $0xff, %ah
  23. int $0x21
  24. cli
  25. pushf
  26. popw %dx
  27. movb $0xff, %ah
  28. int $0x21
  29. sti
  30. pushfl
  31. popl %edx
  32. movb $0xff, %ah
  33. int $0x21
  34. #if 0
  35. movw $GET_OFFSET(IF_msg1), %dx
  36. movb $0x09, %ah
  37. int $0x21
  38. pushf
  39. movw %sp, %bx
  40. andw $~0x200, (%bx)
  41. popf
  42. #else
  43. cli
  44. #endif
  45. pushf
  46. popw %dx
  47. movb $0xff, %ah
  48. int $0x21
  49. pushfl
  50. movw %sp, %bx
  51. orw $0x200, (%bx)
  52. popfl
  53. pushfl
  54. popl %edx
  55. movb $0xff, %ah
  56. int $0x21
  57. movb $0x00, %ah
  58. int $0x21
  59. int90_test:
  60. pushf
  61. pop %dx
  62. movb $0xff, %ah
  63. int $0x21
  64. movw %sp, %bx
  65. movw 4(%bx), %dx
  66. movb $0xff, %ah
  67. int $0x21
  68. movw $GET_OFFSET(int90_msg), %dx
  69. movb $0x09, %ah
  70. int $0x21
  71. iret
  72. int90_msg:
  73. .string "INT90 started\n$"
  74. hello_world:
  75. .string "Hello VM86 world\n$"
  76. IF_msg:
  77. .string "VM86 IF test\n$"
  78. IF_msg1:
  79. .string "If you see a diff here, your Linux kernel is buggy, please update to 2.4.20 kernel\n$"
  80. vm86_code_end: