Fully synchronize sys/boot from FreeBSD-5.x, but add / to the module path
[dragonfly.git] / sys / boot / i386 / btx / lib / btxv86.s
CommitLineData
984263bc
MD
1#
2# Copyright (c) 1998 Robert Nordier
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms are freely
6# permitted provided that the above copyright notice and this
7# paragraph and the following disclaimer are duplicated in all
8# such forms.
9#
10# This software is provided "AS IS" and without any express or
11# implied warranties, including, without limitation, the implied
12# warranties of merchantability and fitness for a particular
13# purpose.
14#
15
16# $FreeBSD: src/sys/boot/i386/btx/lib/btxv86.s,v 1.3 1999/08/28 00:40:08 peter Exp $
5ee58eed 17# $DragonFly: src/sys/boot/i386/btx/lib/Attic/btxv86.s,v 1.3 2003/11/10 06:08:35 dillon Exp $
984263bc
MD
18
19#
20# BTX V86 interface.
21#
22
23#
24# Globals.
25#
26 .global __v86int
27#
28# Fields in V86 interface structure.
29#
30 .set V86_CTL,0x0 # Control flags
31 .set V86_ADDR,0x4 # Int number/address
32 .set V86_ES,0x8 # V86 ES
33 .set V86_DS,0xc # V86 DS
34 .set V86_FS,0x10 # V86 FS
35 .set V86_GS,0x14 # V86 GS
36 .set V86_EAX,0x18 # V86 EAX
37 .set V86_ECX,0x1c # V86 ECX
38 .set V86_EDX,0x20 # V86 EDX
39 .set V86_EBX,0x24 # V86 EBX
40 .set V86_EFL,0x28 # V86 eflags
41 .set V86_EBP,0x2c # V86 EBP
42 .set V86_ESI,0x30 # V86 ESI
43 .set V86_EDI,0x34 # V86 EDI
44#
45# Other constants.
46#
47 .set INT_V86,0x31 # Interrupt number
48 .set SIZ_V86,0x38 # Size of V86 structure
49#
50# V86 interface function.
51#
52__v86int: popl __v86ret # Save return address
53 pushl $__v86 # Push pointer
54 call __v86_swap # Load V86 registers
55 int $INT_V86 # To BTX
56 call __v86_swap # Load user registers
57 addl $0x4,%esp # Discard pointer
58 pushl __v86ret # Restore return address
59 ret # To user
60#
61# Swap V86 and user registers.
62#
63__v86_swap: xchgl %ebp,0x4(%esp,1) # Swap pointer, EBP
64 xchgl %eax,V86_EAX(%ebp) # Swap EAX
65 xchgl %ecx,V86_ECX(%ebp) # Swap ECX
66 xchgl %edx,V86_EDX(%ebp) # Swap EDX
67 xchgl %ebx,V86_EBX(%ebp) # Swap EBX
68 pushl %eax # Save
69 pushf # Put eflags
70 popl %eax # in EAX
71 xchgl %eax,V86_EFL(%ebp) # Swap
72 pushl %eax # Put EAX
73 popf # in eflags
74 movl 0x8(%esp,1),%eax # Load EBP
75 xchgl %eax,V86_EBP(%ebp) # Swap
76 movl %eax,0x8(%esp,1) # Save EBP
77 popl %eax # Restore
78 xchgl %esi,V86_ESI(%ebp) # Swap ESI
79 xchgl %edi,V86_EDI(%ebp) # Swap EDI
80 xchgl %ebp,0x4(%esp,1) # Swap pointer, EBP
81 ret # To caller
82#
83# V86 interface structure.
84#
85 .comm __v86,SIZ_V86
86 .comm __v86ret,4