Franklin Wei | a855d62 | 2017-01-21 15:18:31 -0500 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 1994-1995 Apogee Software, Ltd. |
| 3 | |
| 4 | This program is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU General Public License |
| 6 | as published by the Free Software Foundation; either version 2 |
| 7 | of the License, or (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | |
| 13 | See the GNU General Public License for more details. |
| 14 | |
| 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | |
| 19 | */ |
| 20 | /********************************************************************** |
| 21 | module: DPMI.H |
| 22 | |
| 23 | author: James R. Dose |
| 24 | date: March 31, 1994 |
| 25 | |
| 26 | Inline functions for performing DPMI calls. |
| 27 | |
| 28 | (c) Copyright 1994 James R. Dose. All Rights Reserved. |
| 29 | **********************************************************************/ |
| 30 | |
| 31 | #ifndef __DPMI_H |
| 32 | #define __DPMI_H |
| 33 | |
| 34 | #include "SDL.h" |
| 35 | |
Franklin Wei | a855d62 | 2017-01-21 15:18:31 -0500 | [diff] [blame] | 36 | #include <inttypes.h> |
Franklin Wei | a855d62 | 2017-01-21 15:18:31 -0500 | [diff] [blame] | 37 | |
| 38 | enum DPMI_Errors |
| 39 | { |
| 40 | DPMI_Warning = -2, |
| 41 | DPMI_Error = -1, |
| 42 | DPMI_Ok = 0 |
| 43 | }; |
| 44 | |
| 45 | typedef struct |
| 46 | { |
| 47 | uint32_t EDI; |
| 48 | uint32_t ESI; |
| 49 | uint32_t EBP; |
| 50 | uint32_t Reserved; |
| 51 | uint32_t EBX; |
| 52 | uint32_t EDX; |
| 53 | uint32_t ECX; |
| 54 | uint32_t EAX; |
| 55 | uint32_t Flags; |
| 56 | uint32_t ES; |
| 57 | uint32_t DS; |
| 58 | uint32_t FS; |
| 59 | uint32_t GS; |
| 60 | uint32_t IP; |
| 61 | uint16_t CS; |
| 62 | uint16_t SP; |
| 63 | uint16_t SS; |
| 64 | } dpmi_regs; |
| 65 | |
| 66 | uint32_t DPMI_GetRealModeVector( int num ); |
| 67 | |
| 68 | int DPMI_CallRealModeFunction( dpmi_regs *callregs ); |
| 69 | int DPMI_GetDOSMemory( void **ptr, int *descriptor, unsigned length ); |
| 70 | int DPMI_FreeDOSMemory( int descriptor ); |
| 71 | int DPMI_LockMemory( void *address, unsigned length ); |
| 72 | int DPMI_LockMemoryRegion( void *start, void *end ); |
| 73 | int DPMI_UnlockMemory( void *address, unsigned length ); |
| 74 | int DPMI_UnlockMemoryRegion( void *start, void *end ); |
| 75 | |
| 76 | #define DPMI_Lock( variable ) \ |
| 77 | ( DPMI_LockMemory( &( variable ), sizeof( variable ) ) ) |
| 78 | |
| 79 | #define DPMI_Unlock( variable ) \ |
| 80 | ( DPMI_UnlockMemory( &( variable ), sizeof( variable ) ) ) |
| 81 | |
| 82 | #endif |