You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #define PXENV_UNDI_ISR 0x0014
  2. #define PXENV_UNDI_ISR_IN_START 1
  3. #define PXENV_UNDI_ISR_OUT_OURS 0
  4. #define PXENV_UNDI_ISR_OUT_NOT_OURS 1
  5. #define IRQ_PIC_CUTOFF 8
  6. #define ICR_EOI_NON_SPECIFIC 0x20
  7. #define PIC1_ICR 0x20
  8. #define PIC2_ICR 0xa0
  9. .text
  10. .arch i386
  11. .code16
  12. .section ".text16", "ax", @progbits
  13. .globl undiisr
  14. undiisr:
  15. /* Preserve registers */
  16. pushw %ds
  17. pushw %es
  18. pushw %fs
  19. pushw %gs
  20. pushfl
  21. pushal
  22. /* Set up our segment registers */
  23. movw %cs:rm_ds, %ax
  24. movw %ax, %ds
  25. /* Check that we have an UNDI entry point */
  26. cmpw $0, undinet_entry_point
  27. je chain
  28. /* Issue UNDI API call */
  29. movw %ax, %es
  30. movw $undinet_params, %di
  31. movw $PXENV_UNDI_ISR, %bx
  32. movw $PXENV_UNDI_ISR_IN_START, funcflag
  33. pushw %es
  34. pushw %di
  35. pushw %bx
  36. lcall *undinet_entry_point
  37. cli /* Just in case */
  38. addw $6, %sp
  39. cmpw $PXENV_UNDI_ISR_OUT_OURS, funcflag
  40. jne eoi
  41. trig: /* Record interrupt occurence */
  42. incb undiisr_trigger_count
  43. eoi: /* Send EOI */
  44. movb $ICR_EOI_NON_SPECIFIC, %al
  45. cmpb $IRQ_PIC_CUTOFF, undiisr_irq
  46. jb 1f
  47. outb %al, $PIC2_ICR
  48. 1: outb %al, $PIC1_ICR
  49. jmp exit
  50. chain: /* Chain to next handler */
  51. pushfw
  52. lcall *undiisr_next_handler
  53. exit: /* Restore registers and return */
  54. cli
  55. popal
  56. movzwl %sp, %esp
  57. addr32 movl -20(%esp), %esp /* %esp isn't restored by popal */
  58. popfl
  59. popw %gs
  60. popw %fs
  61. popw %es
  62. popw %ds
  63. iret
  64. .section ".data16", "aw", @progbits
  65. undinet_params:
  66. status: .word 0
  67. funcflag: .word 0
  68. bufferlength: .word 0
  69. framelength: .word 0
  70. frameheaderlength: .word 0
  71. frame: .word 0, 0
  72. prottype: .byte 0
  73. pkttype: .byte 0