#include "regs.S"

.extern intr_handleintr

.global intr_vec0
.global intr_vec1
.global intr_vec2
.global intr_vec3
.global intr_vec4
.global intr_vec5
.global intr_vec6
.global intr_vec7
.global intr_vec8
.global intr_vec9
.global intr_vec10
.global intr_vec11
.global intr_vec12
.global intr_vec13
.global intr_vec14
.global intr_vec15
.global intr_vec16
.global intr_vec17
.global intr_vec18
.global intr_vec19
.global intr_vec20
.global intr_vec21
.global intr_vec22
.global intr_vec23
.global intr_vec24
.global intr_vec25
.global intr_vec26
.global intr_vec27
.global intr_vec28
.global intr_vec29
.global intr_vec30
.global intr_vec31
.global intr_vec32
.global intr_vec33
.global intr_vec34
.global intr_vec35
.global intr_vec36
.global intr_vec37
.global intr_vec38
.global intr_vec39
.global intr_vec40
.global intr_vec41
.global intr_vec42
.global intr_vec43
.global intr_vec44
.global intr_vec45
.global intr_vec46
.global intr_vec47
.global intr_vec128

.macro _vecintr_errorcode_present_save num
  pushq $\num
.endm

.macro _vecintr_plain_save num
  pushq $0x0
  pushq $\num
.endm

.macro _vecintr_bodygen
  cli
  _push_regs
  cld
  movq %rsp, %rdi
  call intr_handleintr
  _pop_regs
  add $0x10, %rsp
  iretq
.endm

intr_vec0:
  _vecintr_plain_save 0
  _vecintr_bodygen
intr_vec1:
  _vecintr_plain_save 1
  _vecintr_bodygen
intr_vec2:
  _vecintr_plain_save 2
  _vecintr_bodygen
intr_vec3:
  _vecintr_plain_save 3
  _vecintr_bodygen
intr_vec4:
  _vecintr_plain_save 4
  _vecintr_bodygen
intr_vec5:
  _vecintr_plain_save 5
  _vecintr_bodygen
intr_vec6:
  _vecintr_plain_save 6
  _vecintr_bodygen
intr_vec7:
  _vecintr_plain_save 7
  _vecintr_bodygen
intr_vec8:
  _vecintr_errorcode_present_save 8
  _vecintr_bodygen
intr_vec9:
  _vecintr_plain_save 9
  _vecintr_bodygen
intr_vec10:
  _vecintr_errorcode_present_save 10
  _vecintr_bodygen
intr_vec11:
  _vecintr_errorcode_present_save 11
  _vecintr_bodygen
intr_vec12:
  _vecintr_errorcode_present_save 12
  _vecintr_bodygen
intr_vec13:
  _vecintr_errorcode_present_save 13
  _vecintr_bodygen
intr_vec14:
  _vecintr_errorcode_present_save 14
  _vecintr_bodygen
intr_vec15:
  _vecintr_plain_save 15
  _vecintr_bodygen
intr_vec16:
  _vecintr_plain_save 16
  _vecintr_bodygen
intr_vec17:
  _vecintr_errorcode_present_save 17
  _vecintr_bodygen
intr_vec18:
  _vecintr_plain_save 18
  _vecintr_bodygen
intr_vec19:
  _vecintr_plain_save 19
  _vecintr_bodygen
intr_vec20:
  _vecintr_plain_save 20
  _vecintr_bodygen
intr_vec21:
  _vecintr_errorcode_present_save 21
  _vecintr_bodygen
intr_vec22: 
  _vecintr_plain_save 22
  _vecintr_bodygen
intr_vec23: 
  _vecintr_plain_save 23
  _vecintr_bodygen
intr_vec24: 
  _vecintr_plain_save 24
  _vecintr_bodygen
intr_vec25: 
  _vecintr_plain_save 25
  _vecintr_bodygen
intr_vec26: 
  _vecintr_plain_save 26
  _vecintr_bodygen
intr_vec27: 
  _vecintr_plain_save 27
  _vecintr_bodygen
intr_vec28: 
  _vecintr_plain_save 28
  _vecintr_bodygen
intr_vec29:
  _vecintr_errorcode_present_save 29
  _vecintr_bodygen
intr_vec30:
  _vecintr_errorcode_present_save 30
  _vecintr_bodygen
intr_vec31: 
  _vecintr_plain_save 31
  _vecintr_bodygen
intr_vec32: 
  _vecintr_plain_save 32
  _vecintr_bodygen
intr_vec33: 
  _vecintr_plain_save 33
  _vecintr_bodygen
intr_vec34: 
  _vecintr_plain_save 34
  _vecintr_bodygen
intr_vec35: 
  _vecintr_plain_save 35
  _vecintr_bodygen
intr_vec36: 
  _vecintr_plain_save 36
  _vecintr_bodygen
intr_vec37: 
  _vecintr_plain_save 37
  _vecintr_bodygen
intr_vec38: 
  _vecintr_plain_save 38
  _vecintr_bodygen
intr_vec39: 
  _vecintr_plain_save 39
  _vecintr_bodygen
intr_vec40: 
  _vecintr_plain_save 40
  _vecintr_bodygen
intr_vec41: 
  _vecintr_plain_save 41
  _vecintr_bodygen
intr_vec42: 
  _vecintr_plain_save 42
  _vecintr_bodygen
intr_vec43: 
  _vecintr_plain_save 43
  _vecintr_bodygen
intr_vec44: 
  _vecintr_plain_save 44
  _vecintr_bodygen
intr_vec45: 
  _vecintr_plain_save 45
  _vecintr_bodygen
intr_vec46: 
  _vecintr_plain_save 46
  _vecintr_bodygen
intr_vec47: 
  _vecintr_plain_save 47
  _vecintr_bodygen
intr_vec128: 
  _vecintr_plain_save 128
  _vecintr_bodygen
