#1# Copyright (c) 1998 Robert Nordier2# All rights reserved.3#4# Redistribution and use in source and binary forms are freely5# permitted provided that the above copyright notice and this6# paragraph and the following disclaimer are duplicated in all7# such forms.8#9# This software is provided "AS IS" and without any express or10# implied warranties, including, without limitation, the implied11# warranties of merchantability and fitness for a particular12# purpose.13#1415#16# BTX V86 interface.17#1819#20# Globals.21#22.global __v86int23#24# Fields in V86 interface structure.25#26.set V86_CTL,0x0 # Control flags27.set V86_ADDR,0x4 # Int number/address28.set V86_ES,0x8 # V86 ES29.set V86_DS,0xc # V86 DS30.set V86_FS,0x10 # V86 FS31.set V86_GS,0x14 # V86 GS32.set V86_EAX,0x18 # V86 EAX33.set V86_ECX,0x1c # V86 ECX34.set V86_EDX,0x20 # V86 EDX35.set V86_EBX,0x24 # V86 EBX36.set V86_EFL,0x28 # V86 eflags37.set V86_EBP,0x2c # V86 EBP38.set V86_ESI,0x30 # V86 ESI39.set V86_EDI,0x34 # V86 EDI40#41# Other constants.42#43.set INT_V86,0x31 # Interrupt number44.set SIZ_V86,0x38 # Size of V86 structure45#46# V86 interface function.47#48__v86int: popl __v86ret # Save return address49pushl $__v86 # Push pointer50call __v86_swap # Load V86 registers51int $INT_V86 # To BTX52call __v86_swap # Load user registers53addl $0x4,%esp # Discard pointer54pushl __v86ret # Restore return address55ret # To user56#57# Swap V86 and user registers.58#59__v86_swap: xchgl %ebp,0x4(%esp,1) # Swap pointer, EBP60xchgl %eax,V86_EAX(%ebp) # Swap EAX61xchgl %ecx,V86_ECX(%ebp) # Swap ECX62xchgl %edx,V86_EDX(%ebp) # Swap EDX63xchgl %ebx,V86_EBX(%ebp) # Swap EBX64pushl %eax # Save65pushf # Put eflags66popl %eax # in EAX67xchgl %eax,V86_EFL(%ebp) # Swap68pushl %eax # Put EAX69popf # in eflags70movl 0x8(%esp,1),%eax # Load EBP71xchgl %eax,V86_EBP(%ebp) # Swap72movl %eax,0x8(%esp,1) # Save EBP73popl %eax # Restore74xchgl %esi,V86_ESI(%ebp) # Swap ESI75xchgl %edi,V86_EDI(%ebp) # Swap EDI76xchgl %ebp,0x4(%esp,1) # Swap pointer, EBP77ret # To caller78#79# V86 interface structure.80#81.comm __v86,SIZ_V8682.comm __v86ret,4838485