3 * Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 .intel_syntax noprefix
64 * int Int386(int ivec, REGS* in, REGS* out);
69 /* Get the function parameters */
70 mov Int386_vector, rcx
71 mov Int386_vector_opcode, cl
72 mov Int386_regsin, rdx
73 mov Int386_regsout, r8
75 /* Save all registers + segment registers */
86 /* Copy the input regs to our variables */
88 mov esi, Int386_regsin
92 call x86_64_SwitchToReal
95 /* Setup the registers */
97 mov ds, ax /* DS register */
99 mov es, ax /* ES register */
101 mov fs, ax /* FS register */
103 mov gs, ax /* GS register */
105 mov eax, cs:Int386_eax /* EAX register */
106 mov ebx, cs:Int386_ebx /* EBX register */
107 mov ecx, cs:Int386_ecx /* ECX register */
108 mov edx, cs:Int386_edx /* EDX register */
110 mov esi, cs:Int386_esi /* ESI register */
111 mov edi, cs:Int386_edi /* EDI register */
113 /* Do not set the flags register */
114 /* only return its value in regsout */
115 //pushl Int386_eflags
116 //popfl /* EFLAGS register */
118 /* Call the interrupt vector */
119 /*int Int386_vector*/
122 Int386_vector_opcode:
125 /* Save the registers */
126 mov cs:Int386_eax, eax /* EAX register */
127 mov cs:Int386_ebx, ebx /* EBX register */
128 mov cs:Int386_ecx, ecx /* ECX register */
129 mov cs:Int386_edx, edx /* EDX register */
131 mov cs:Int386_esi, esi /* ESI register */
132 mov cs:Int386_edi, edi /* EDI register */
134 mov ax, ds /* DS register */
136 mov ax, es /* ES register */
138 mov ax, fs /* FS register */
140 mov ax, gs /* GS register */
144 pop cs:Int386_eflags /* EFLAGS register */
146 call x86_16_SwitchToLong
149 /* Copy the variables to the output regs */
151 mov rdi, Int386_regsout
155 /* Restore segment and all other registers */
166 /* Get return value */