3 Copyright (C) 2007-2009 Jörg Pfähler
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <Makefile.asm.config>
23 .global executeV8086Thread
28 /*#############################################################################
29 ##### code segment #####
30 #############################################################################*/
32 /*#############################################################################
33 ##### Execute an interrupt in virtual-8086-mode #####
34 #############################################################################*/
36 /* Initialize the kernel virtual-8086-TSS */
37 movl $0x300000, (kernelTSS + 28)
38 movl $0x10, (kernelTSS + 72)
39 movl $0x08, (kernelTSS + 76)
40 movl $0x10, (kernelTSS + 80)
41 movl $0x10, (kernelTSS + 84)
42 movl $0x10, (kernelTSS + 88)
43 movl $0x10, (kernelTSS + 92)
45 /* Initialize the virtual-8086-TSS */
46 movl $0xFFFFE000, (v8086TSS + 4) // esp0
47 movl $0x10, (v8086TSS + 8) // ss0
48 movl $0x300000, (v8086TSS + 28) // cr3
49 movw $0x88, (v8086TSS + 102)
50 movb $0x40, (v8086TSS + 135)
52 /* safe kernel state in tss */
53 movl $int86_return, (kernelTSS+32)
54 movl $0x01, (kernelTSS+40)
55 mov %ecx, (kernelTSS+44)
56 mov %edx, (kernelTSS+48)
57 mov %ebx, (kernelTSS+52)
58 mov %esp, (kernelTSS+56)
59 mov %ebp, (kernelTSS+60)
60 mov %esi, (kernelTSS+64)
61 mov %edi, (kernelTSS+68)
64 mov %eax, (kernelTSS+36)
84 pushl $0x0000 /* ss */
85 pushl $0x1000 /* esp */
86 pushl $0x23202 /* eflags */
88 pushl $0x100 /* eip */
104 and $0xFFFFBFFF, %eax
109 mov $0xFFFFDFB4, %esp
119 and $0xFFFFBFFF, %eax
131 mov v8086TSS+40, %eax
133 mov v8086TSS+52, %eax
135 mov v8086TSS+44, %eax
137 mov v8086TSS+48, %eax
139 mov v8086TSS+84, %eax
141 mov v8086TSS+72, %eax
143 mov v8086TSS+68, %eax
145 mov v8086TSS+64, %eax
151 /*#############################################################################
152 ##### BSS segment #####
153 #############################################################################*/
155 /*########################################################################
156 ##### virtual-8086-mode tss #####
157 ########################################################################*/
162 /*########################################################################
163 ##### Kernel TSS for virtual-8086-tasks #####
164 ########################################################################*/