1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
| [bits 32] %define ERROR_CODE nop %define ZERO push 0
extern put_str extern idt_table extern syscall_table
section .data global intr_entry_table intr_entry_table:
%macro VECTOR 2 section .text intr%1entry:
%2
push ds push es push fs push gs pushad
mov al,0x20 out 0xa0,al out 0x20,al
push %1 call [idt_table + %1*4] jmp intr_exit section .data dd intr%1entry %endmacro
section .text global intr_exit intr_exit:
add esp, 4 popad pop gs pop fs pop es pop ds add esp, 4 iretd
section .text global syscall_handler syscall_handler:
push 0
push ds push es push fs push gs pushad push 0x80
push edx push ecx push ebx
call [syscall_table + eax*4] add esp, 12
mov [esp + 8*4], eax jmp intr_exit
VECTOR 0x00,ZERO VECTOR 0x01,ZERO VECTOR 0x02,ZERO VECTOR 0x03,ZERO VECTOR 0x04,ZERO VECTOR 0x05,ZERO VECTOR 0x06,ZERO VECTOR 0x07,ZERO VECTOR 0x08,ERROR_CODE VECTOR 0x09,ZERO VECTOR 0x0a,ERROR_CODE VECTOR 0x0b,ERROR_CODE VECTOR 0x0c,ZERO VECTOR 0x0d,ERROR_CODE VECTOR 0x0e,ERROR_CODE VECTOR 0x0f,ZERO VECTOR 0x10,ZERO VECTOR 0x11,ERROR_CODE VECTOR 0x12,ZERO VECTOR 0x13,ZERO VECTOR 0x14,ZERO VECTOR 0x15,ZERO VECTOR 0x16,ZERO VECTOR 0x17,ZERO VECTOR 0x18,ERROR_CODE VECTOR 0x19,ZERO VECTOR 0x1a,ERROR_CODE VECTOR 0x1b,ERROR_CODE VECTOR 0x1c,ZERO VECTOR 0x1d,ERROR_CODE VECTOR 0x1e,ERROR_CODE VECTOR 0x1f,ZERO VECTOR 0x20,ZERO
VECTOR 0x21,ZERO VECTOR 0x22,ZERO VECTOR 0x23,ZERO VECTOR 0x24,ZERO VECTOR 0x25,ZERO VECTOR 0x26,ZERO VECTOR 0x27,ZERO VECTOR 0x28,ZERO VECTOR 0x29,ZERO VECTOR 0x2a,ZERO VECTOR 0x2b,ZERO VECTOR 0x2c,ZERO VECTOR 0x2d,ZERO VECTOR 0x2e,ZERO VECTOR 0x2f,ZERO
VECTOR 0x30 ,ZERO VECTOR 0x31 ,ZERO VECTOR 0x32 ,ZERO VECTOR 0x33 ,ZERO VECTOR 0x34 ,ZERO VECTOR 0x35 ,ZERO VECTOR 0x36 ,ZERO VECTOR 0x37 ,ZERO VECTOR 0x38 ,ZERO VECTOR 0x39 ,ZERO VECTOR 0x3A ,ZERO VECTOR 0x3B ,ZERO VECTOR 0x3C ,ZERO VECTOR 0x3D ,ZERO VECTOR 0x3E ,ZERO VECTOR 0x3F ,ZERO VECTOR 0x40 ,ZERO VECTOR 0x41 ,ZERO VECTOR 0x42 ,ZERO VECTOR 0x43 ,ZERO VECTOR 0x44 ,ZERO VECTOR 0x45 ,ZERO VECTOR 0x46 ,ZERO VECTOR 0x47 ,ZERO VECTOR 0x48 ,ZERO VECTOR 0x49 ,ZERO VECTOR 0x4A ,ZERO VECTOR 0x4B ,ZERO VECTOR 0x4C ,ZERO VECTOR 0x4D ,ZERO VECTOR 0x4E ,ZERO VECTOR 0x4F ,ZERO VECTOR 0x50 ,ZERO VECTOR 0x51 ,ZERO VECTOR 0x52 ,ZERO VECTOR 0x53 ,ZERO VECTOR 0x54 ,ZERO VECTOR 0x55 ,ZERO VECTOR 0x56 ,ZERO VECTOR 0x57 ,ZERO VECTOR 0x58 ,ZERO VECTOR 0x59 ,ZERO VECTOR 0x5A ,ZERO VECTOR 0x5B ,ZERO VECTOR 0x5C ,ZERO VECTOR 0x5D ,ZERO VECTOR 0x5E ,ZERO VECTOR 0x5F ,ZERO VECTOR 0x61 ,ZERO VECTOR 0x62 ,ZERO VECTOR 0x63 ,ZERO VECTOR 0x64 ,ZERO VECTOR 0x65 ,ZERO VECTOR 0x66 ,ZERO VECTOR 0x67 ,ZERO VECTOR 0x68 ,ZERO VECTOR 0x69 ,ZERO VECTOR 0x6A ,ZERO VECTOR 0x6B ,ZERO VECTOR 0x6C ,ZERO VECTOR 0x6D ,ZERO VECTOR 0x6E ,ZERO VECTOR 0x6F ,ZERO VECTOR 0x70 ,ZERO VECTOR 0x71 ,ZERO VECTOR 0x72 ,ZERO VECTOR 0x73 ,ZERO VECTOR 0x74 ,ZERO VECTOR 0x75 ,ZERO VECTOR 0x76 ,ZERO VECTOR 0x77 ,ZERO VECTOR 0x78 ,ZERO VECTOR 0x79 ,ZERO VECTOR 0x7A ,ZERO VECTOR 0x7B ,ZERO VECTOR 0x7C ,ZERO VECTOR 0x7D ,ZERO VECTOR 0x7E ,ZERO VECTOR 0x7F ,ZERO VECTOR 0x80 ,ZERO
|