Last active
August 29, 2015 14:10
-
-
Save mopp/258be56b905c15170323 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;--------------------------------------------------------------------- | |
; vim:ft=nasm:foldmethod=marker | |
; File: src/interrupt_handler.asm | |
; Description: It provides interrupt handler entry point | |
;--------------------------------------------------------------------- | |
bits 32 | |
section .text | |
extern interrupt_timer | |
global asm_interrupt_timer | |
asm_interrupt_timer | |
; 後々出てくる構造体のための擬似エラーコード | |
push 0 | |
; レジスタを保存 | |
push ds | |
push es | |
push fs | |
push gs | |
pushad | |
; 現在のespを関数の引数としてスタックへ | |
push esp | |
; タイマ割り込み本体へ | |
call interrupt_timer | |
; 引数を除去 | |
add esp, 4 | |
jmp interrupt_return | |
global interrupt_return | |
interrupt_return: | |
; 保存していたレジスタを復元 | |
popad | |
pop gs | |
pop fs | |
pop es | |
pop ds | |
; 擬似エラーコード削除 | |
add esp, 4 | |
; 割り込みから復帰 | |
iret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment