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.
63 * int Int386(int ivec, REGS* in, REGS* out);
68 /* Get the function parameters */
70 movl %eax,Int386_vector
71 movb %al,Int386_vector_opcode
73 movl %eax,Int386_regsin
75 movl %eax,Int386_regsout
77 /* Save all registers + segment registers */
84 /* Copy the input regs to our variables */
85 movl $Int386_REGS,%edi
86 movl Int386_regsin,%esi
94 /* Setup the registers */
95 movw %cs:Int386_ds,%ax
96 movw %ax,%ds /* DS register */
97 movw %cs:Int386_es,%ax
98 movw %ax,%es /* ES register */
99 movw %cs:Int386_fs,%ax
100 movw %ax,%fs /* FS register */
101 movw %cs:Int386_gs,%ax
102 movw %ax,%gs /* GS register */
104 movl %cs:Int386_eax,%eax /* EAX register */
105 movl %cs:Int386_ebx,%ebx /* EBX register */
106 movl %cs:Int386_ecx,%ecx /* ECX register */
107 movl %cs:Int386_edx,%edx /* EDX register */
109 movl %cs:Int386_esi,%esi /* ESI register */
110 movl %cs:Int386_edi,%edi /* EDI register */
112 /* Do not set the flags register */
113 /* only return its value in regsout */
114 //pushl Int386_eflags
115 //popfl /* EFLAGS register */
117 /* Call the interrupt vector */
118 /*int Int386_vector*/
121 Int386_vector_opcode:
124 /* Save the registers */
125 movl %eax,%cs:Int386_eax /* EAX register */
126 movl %ebx,%cs:Int386_ebx /* EBX register */
127 movl %ecx,%cs:Int386_ecx /* ECX register */
128 movl %edx,%cs:Int386_edx /* EDX register */
130 movl %esi,%cs:Int386_esi /* ESI register */
131 movl %edi,%cs:Int386_edi /* EDI register */
133 movw %ds,%ax /* DS register */
134 movw %ax,%cs:Int386_ds
135 movw %es,%ax /* ES register */
136 movw %ax,%cs:Int386_es
137 movw %fs,%ax /* FS register */
138 movw %ax,%cs:Int386_fs
139 movw %gs,%ax /* GS register */
140 movw %ax,%cs:Int386_gs
143 popw %cs:Int386_eflags /* EFLAGS register */
148 /* Copy the variables to the output regs */
149 movl $Int386_REGS,%esi
150 movl Int386_regsout,%edi
155 /* Restore segment and all other registers */
164 /* Get return value */