.model 386.text; Copyright 2010 released to public domain by Gerald Lindsly; Copyright 2009 Intel Corporation; author H. Peter Anvin; This file was part of the Linux kernel, and was made available under; the terms of the GNU General Public License version 2 or (at your; option) any later version; incorporated herein by reference. ; Dredged to MASM Standard. Intel... a := b; "Glove box" for BIOS calls. Avoids the constant problems with BIOSes; touching registers they shouldn't be. public intcall ; Self-modify the INT instruction. Ugly, but works. cmp al,INTop je L1 mov INTop,al jmp L1 ; Synchronize pipelineL1: ; Save state pushf push fs push gs pushall; Copy input state to stack frame sub sp,44h mov si,dx mov di,sp mov cx,11h rep: movsd; Pop full state from the stack popall pop gs pop fs pop es pop ds popf; Actual INT db 0CDh ; INT opcodeINTop: db 0; Push full state to the stack pushf push ds push es push fs push gs pushall; Re-establish C environment invariants cld movzx esp,sp mov ax,cs mov ds,ax mov es,ax; Copy output state from stack frame mov esp+68,di ; Original cx == 3rd argument and di,di jz L4 mov si,sp mov cx,11h rep: movsd L4: add sp,44h; Restore state and return popall pop gs pop fs popf retfend