Deleted Added
full compact
vm86bios.s (69431) vm86bios.s (69971)
1/*-
2 * Copyright (c) 1998 Jonathan Lemon
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Jonathan Lemon
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/i386/i386/vm86bios.s 69431 2000-12-01 02:09:45Z jake $
26 * $FreeBSD: head/sys/i386/i386/vm86bios.s 69971 2000-12-13 09:23:53Z jake $
27 */
28
29#include <machine/asmacros.h> /* miscellaneous asm macros */
30#include <machine/trap.h>
31
32#include "assym.s"
33
34#define SCR_NEWPTD PCB_ESI /* readability macros */

--- 23 unchanged lines hidden (view full) ---

58 movl %eax,SCR_ARGFRAME(%edx) /* save argument pointer */
59 pushl %ebx
60 pushl %ebp
61 pushl %esi
62 pushl %edi
63 pushl %gs
64
65#if NNPX > 0
27 */
28
29#include <machine/asmacros.h> /* miscellaneous asm macros */
30#include <machine/trap.h>
31
32#include "assym.s"
33
34#define SCR_NEWPTD PCB_ESI /* readability macros */

--- 23 unchanged lines hidden (view full) ---

58 movl %eax,SCR_ARGFRAME(%edx) /* save argument pointer */
59 pushl %ebx
60 pushl %ebp
61 pushl %esi
62 pushl %edi
63 pushl %gs
64
65#if NNPX > 0
66 movl _curproc,%ecx
67 cmpl %ecx,_npxproc /* do we need to save fp? */
66 movl PCPU(CURPROC),%ecx
67 cmpl %ecx,PCPU(NPXPROC) /* do we need to save fp? */
68 jne 1f
69 testl %ecx,%ecx
70 je 1f /* no curproc/npxproc */
71 pushl %edx
72 movl P_ADDR(%ecx),%ecx
73 addl $PCB_SAVEFPU,%ecx
74 pushl %ecx
75 call _npxsave

--- 5 unchanged lines hidden (view full) ---

81 movl SCR_VMFRAME(%edx),%ebx /* target frame location */
82 movl %ebx,%edi /* destination */
83 movl SCR_ARGFRAME(%edx),%esi /* source (set on entry) */
84 movl $VM86_FRAMESIZE/4,%ecx /* sizeof(struct vm86frame)/4 */
85 cld
86 rep
87 movsl /* copy frame to new stack */
88
68 jne 1f
69 testl %ecx,%ecx
70 je 1f /* no curproc/npxproc */
71 pushl %edx
72 movl P_ADDR(%ecx),%ecx
73 addl $PCB_SAVEFPU,%ecx
74 pushl %ecx
75 call _npxsave

--- 5 unchanged lines hidden (view full) ---

81 movl SCR_VMFRAME(%edx),%ebx /* target frame location */
82 movl %ebx,%edi /* destination */
83 movl SCR_ARGFRAME(%edx),%esi /* source (set on entry) */
84 movl $VM86_FRAMESIZE/4,%ecx /* sizeof(struct vm86frame)/4 */
85 cld
86 rep
87 movsl /* copy frame to new stack */
88
89 movl _curpcb,%eax
89 movl PCPU(CURPCB),%eax
90 pushl %eax /* save curpcb */
90 pushl %eax /* save curpcb */
91 movl %edx,_curpcb /* set curpcb to vm86pcb */
91 movl %edx,PCPU(CURPCB) /* set curpcb to vm86pcb */
92
92
93 movl _tss_gdt,%ebx /* entry in GDT */
93 movl PCPU(TSS_GDT),%ebx /* entry in GDT */
94 movl 0(%ebx),%eax
95 movl %eax,SCR_TSS0(%edx) /* save first word */
96 movl 4(%ebx),%eax
97 andl $~0x200, %eax /* flip 386BSY -> 386TSS */
98 movl %eax,SCR_TSS1(%edx) /* save second word */
99
100 movl PCB_EXT(%edx),%edi /* vm86 tssd entry */
101 movl 0(%edi),%eax

--- 22 unchanged lines hidden (view full) ---

124
125 call _vm86_prepcall /* finish setup */
126
127 movl $1,_in_vm86call /* set flag for trap() */
128
129 /*
130 * Return via _doreti
131 */
94 movl 0(%ebx),%eax
95 movl %eax,SCR_TSS0(%edx) /* save first word */
96 movl 4(%ebx),%eax
97 andl $~0x200, %eax /* flip 386BSY -> 386TSS */
98 movl %eax,SCR_TSS1(%edx) /* save second word */
99
100 movl PCB_EXT(%edx),%edi /* vm86 tssd entry */
101 movl 0(%edi),%eax

--- 22 unchanged lines hidden (view full) ---

124
125 call _vm86_prepcall /* finish setup */
126
127 movl $1,_in_vm86call /* set flag for trap() */
128
129 /*
130 * Return via _doreti
131 */
132 incb _intr_nesting_level
132 incb PCPU(INTR_NESTING_LEVEL)
133 MEXITCOUNT
134 jmp _doreti
135
136
137/*
138 * vm86_biosret(struct trapframe_vm86 *vm86)
139 */
140ENTRY(vm86_biosret)

--- 10 unchanged lines hidden (view full) ---

151 popl %ebx /* saved va of Idle PTD */
152 popl %eax
153 movl %eax,0(%ebx) /* restore old pte */
154 popl %eax
155 movl %eax,%cr3 /* install old page table */
156
157 movl $0,_in_vm86call /* reset trapflag */
158
133 MEXITCOUNT
134 jmp _doreti
135
136
137/*
138 * vm86_biosret(struct trapframe_vm86 *vm86)
139 */
140ENTRY(vm86_biosret)

--- 10 unchanged lines hidden (view full) ---

151 popl %ebx /* saved va of Idle PTD */
152 popl %eax
153 movl %eax,0(%ebx) /* restore old pte */
154 popl %eax
155 movl %eax,%cr3 /* install old page table */
156
157 movl $0,_in_vm86call /* reset trapflag */
158
159 movl _tss_gdt,%ebx /* entry in GDT */
159 movl PCPU(TSS_GDT),%ebx /* entry in GDT */
160 movl SCR_TSS0(%edx),%eax
161 movl %eax,0(%ebx) /* restore first word */
162 movl SCR_TSS1(%edx),%eax
163 movl %eax,4(%ebx) /* restore second word */
164 movl $GPROC0_SEL*8,%esi /* GSEL(entry, SEL_KPL) */
165 ltr %si
166
160 movl SCR_TSS0(%edx),%eax
161 movl %eax,0(%ebx) /* restore first word */
162 movl SCR_TSS1(%edx),%eax
163 movl %eax,4(%ebx) /* restore second word */
164 movl $GPROC0_SEL*8,%esi /* GSEL(entry, SEL_KPL) */
165 ltr %si
166
167 popl _curpcb /* restore curpcb/curproc */
167 popl PCPU(CURPCB) /* restore curpcb/curproc */
168 movl SCR_ARGFRAME(%edx),%edx /* original stack frame */
169 movl TF_TRAPNO(%edx),%eax /* return (trapno) */
170
171 popl %gs
172 popl %edi
173 popl %esi
174 popl %ebp
175 popl %ebx
176 ret /* back to our normal program */
168 movl SCR_ARGFRAME(%edx),%edx /* original stack frame */
169 movl TF_TRAPNO(%edx),%eax /* return (trapno) */
170
171 popl %gs
172 popl %edi
173 popl %esi
174 popl %ebp
175 popl %ebx
176 ret /* back to our normal program */