📄 markfile
字号:
00318 o16 mov ax, KERNEL_VDATA_SELECTOR ;\00319 mov ds, ax /* we don't touch ss, becasue it was */;\00320 mov es, ax /* already setup by kernel TSS if the */;\00321 mov fs, ax /* previous mode is user. If the previous */;\00322 mov gs, ax /* mode is kernel, reload is trivial. */;\00323 mov eax,esp /* use eax as a base pointer. */;\00324 push esp /* esp points to common stack frame */;\00325 push 60(eax) /* get cs pushed. */;\00326 inb INT_CTLMASK ;\00327 orb al, [1<<irq] ;\00328 outb INT_CTLMASK /* disable the irq */;\00329 movb al, ENABLE ;\00330 outb INT_CTL /* reenable master 8259 */;\00331 sti /* enable interrupts */;\00332 test (esp), RING0 ;\00333 je 1f /* if ring0 */;\00334 call [handler] /* call interrupt handler */;\00335 add esp, 4*2 /* pop used C arguments */;\00336 2: cli /* disable interrupts */;\00337 cmpb (_runrun), 0 ;\00338 je 2f ;\00339 sti /* unlock */;\00340 call _swtch ;\00341 jmp 2b ;\00342 2: pop gs /* return to user mode */;\00343 pop fs ;\00344 pop es ;\00345 pop ds ;\00346 popad ;\00347 add esp, 4*2 /* pop padding space */;\00348 inb INT_CTLMASK ;\00349 andb al, ~[1<<irq] ;\00350 outb INT_CTLMASK /* enable irq */;\00351 iretd ;\00352 1: call [handler] /* call interrupt handler */;\00353 add esp, 4*2 /* pop used C arguemts */;\00354 cli /* disable interrupts */;\00355 pop gs /* return to kernel mode */;\00356 pop fs ;\00357 pop es ;\00358 pop ds ;\00359 popad ;\00360 add esp, 4*2 /* pop padding space */;\00361 inb INT_CTLMASK ;\00362 andb al, ~[1<<irq] ;\00363 outb INT_CTLMASK /* enable irq */;\00364 iretd ;\00365 00366 ! Each of tese entry points is an expansion of the hwint_master macro00367 .align 1600368 _hwint00: ! Interrupt routine for clock interrupt.00369 hwint_master(0, _clock_handler)00370 00371 .align 1600372 _hwint01: ! Interrupt routine for keyboard interrup.00373 hwint_master(1, _kbd_hw_int)00374 00375 .align 1600376 _hwint02:00377 hwint_master(2, _nohandler)00378 00379 .align 1600380 _hwint03:00381 hwint_master(3, _nohandler)00382 00383 .align 1600384 _hwint04:00385 hwint_master(4, _nohandler)00386 00387 .align 1600388 _hwint05:00389 hwint_master(5, _nohandler)00390 00391 .align 1600392 _hwint06:00393 hwint_master(6, _nohandler)00394 00395 .align 1600396 _hwint07:00397 hwint_master(7, _nohandler)00398 00399 !*===========================================================================*00400 !* hwint08 - 15 *00401 !*===========================================================================*00402 ! Note this is a macro, it looks like a subroutine.00403 #define hwint_slave(irq, handler) \00404 cld /* set direction flag to a know value */;\00405 push 0 /* padding for error code */;\00406 push irq /* interrupt irq */;\00407 pushad /* save general registers */;\00408 push ds /* save ds */;\00409 push es /* save es */;\00410 push fs /* save fs */;\00411 push gs /* save gs */;\00412 o16 mov ax, KERNEL_VDATA_SELECTOR ;\00413 mov ds, ax /* we don't touch ss, becasue it was */;\00414 mov es, ax /* already setup by kernel TSS if the */;\00415 mov fs, ax /* previous mode is user. If the previous */;\00416 mov gs, ax /* mode is kernel, reload is trivial. */;\00417 mov eax,esp /* use eax as a base pointer. */;\00418 push esp /* esp points to common stack frame */;\00419 push 60(eax) /* get cs pushed. */;\00420 inb INT2_CTLMASK ;\00421 orb al, [1<<[irq-8]] ;\00422 outb INT2_CTLMASK /* disable the irq */;\00423 movb al, ENABLE ;\00424 outb INT_CTL /* reenable master 8259 */;\00425 jmp .+2 /* delay */;\00426 outb INT2_CTL /* reenable slave 8259 */;\00427 sti /* enable interrupts */;\00428 test (esp), RING0 ;\00429 je 1f /* if ring0 */;\00430 call [handler] /* call interrupt handler */;\00431 add esp, 4*2 /* pop used C arguments */;\00432 2: cli /* disable interrupts */;\00433 cmpb (_runrun), 0 ;\00434 je 2f ;\00435 sti /* unlock */;\00436 call _swtch ;\00437 jmp 2b ;\00438 2: pop gs /* return to user mode */;\00439 pop fs ;\00440 pop es ;\00441 pop ds ;\00442 popad ;\00443 add esp, 4*2 /* pop padding space */;\00444 inb INT2_CTLMASK ;\00445 andb al, ~[1<<[irq-8]] ;\00446 outb INT2_CTLMASK /* enable irq */;\00447 iretd ;\00448 1: call [handler] /* call interrupt handler */;\00449 add esp, 4*2 /* pop used C arguemts */;\00450 cli /* disable interrupts */;\00451 pop gs /* return to kernel mode */;\00452 pop fs ;\00453 pop es ;\00454 pop ds ;\00455 popad ;\00456 add esp, 4*2 /* pop padding space */;\00457 inb INT2_CTLMASK ;\00458 andb al, ~[1<<[irq-8]] ;\00459 outb INT2_CTLMASK /* enable irq */;\00460 iretd ;\00461 00462 ! Each of tese entry points is an expansion of the hwint_master macro00463 .align 1600464 _hwint08:00465 hwint_slave(8, _nohandler)00466 00467 .align 1600468 _hwint09:00469 hwint_slave(9, _nohandler)00470 00471 .align 1600472 _hwint10:00473 hwint_slave(10, _nohandler)00474 00475 .align 1600476 _hwint11:00477 hwint_slave(11, _nohandler)00478 00479 .align 1600480 _hwint12:00481 hwint_slave(12, _nohandler)00482 00483 .align 1600484 _hwint13:00485 hwint_slave(13, _nohandler)00486 00487 .align 1600488 _hwint14:00489 hwint_slave(14, _nohandler)00490 00491 .align 1600492 _hwint15:00493 hwint_slave(15, _nohandler)00494 00495 !*===========================================================================*00496 !* exception handlers *00497 !*===========================================================================*00498 ! If an exception vector doesn't have an error code to be pushed by processor, 00499 ! we would like to fill this space with a padding value, so that we can use one00500 ! routine to handle them all. See src/type.h for the layout of the stackframe00501 00502 _divide_error:00503 push 0 ! padding for error code 00504 push DIVIDE_VECTOR00505 jmp trap00506 00507 _single_step_exception:00508 push 0 ! padding for error code 00509 push DEBUG_VECTOR00510 jmp trap00511 00512 _nmi:00513 push 0 ! padding for error code 00514 push NMI_VECTOR00515 jmp trap00516 00517 _breakpoint_exception:00518 push 0 ! padding for error code 00519 push BREAKPOINT_VECTOR00520 jmp trap00521 00522 _overflow:00523 push 0 ! padding for error code 00524 push OVERFLOW_VECTOR00525 jmp trap00526 00527 _bounds_check:00528 push 0 ! padding for error code 00529 push BOUNDS_VECTOR00530 jmp trap00531 00532 _inval_opcode:00533 push 0 ! padding for error code 00534 push INVAL_OP_VECTOR00535 jmp trap00536
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -