Skip to content

Instantly share code, notes, and snippets.

@mopp
Last active August 29, 2015 14:10
Show Gist options
  • Save mopp/258be56b905c15170323 to your computer and use it in GitHub Desktop.
Save mopp/258be56b905c15170323 to your computer and use it in GitHub Desktop.
;---------------------------------------------------------------------
; 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