rc.8: Fix description of fsck durig startup
[dragonfly.git] / usr.bin / doscmd / xms.h
blobf74c3540698549d4fb2a90a4ac5f9620551bd783
1 /*-
2 * Copyright (c) 1997 Helmut Wirth <hfwirth@ping.at>
3 * All rights reserved.
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 * notice immediately at the beginning of the file, witout modification,
10 * this list of conditions, and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * $FreeBSD: src/usr.bin/doscmd/xms.h,v 1.2 1999/08/28 01:00:27 peter Exp $
29 * $DragonFly: src/usr.bin/doscmd/xms.h,v 1.3 2008/10/03 19:56:11 swildner Exp $
32 #ifndef XMS_H
33 #define XMS_H
35 #define XMS_VERSION 0x0300 /* version 3.00 */
36 #define XMS_REVISION 0x0100 /* driver revision 1.0 */
38 #define NUM_HANDLES 64 /* number of available handles */
39 #define FIRST_HANDLE 1 /* number of firts valid handle */
40 #define PARAGRAPH 16 /* bytes in a paragraph */
41 #define MAX_BLOCK_LOCKS 256 /* number of locks on a block */
42 #define DEFAULT_EMM_SIZE 512 * 1024 /* default EMM size */
44 /* Register AH codes for XMS functions */
45 #define XMS_GET_VERSION 0x00
46 #define XMS_ALLOCATE_HIGH_MEMORY 0x01
47 #define XMS_FREE_HIGH_MEMORY 0x02
48 #define XMS_GLOBAL_ENABLE_A20 0x03
49 #define XMS_GLOBAL_DISABLE_A20 0x04
50 #define XMS_LOCAL_ENABLE_A20 0x05
51 #define XMS_LOCAL_DISABLE_A20 0x06
52 #define XMS_QUERY_A20 0x07
53 #define XMS_QUERY_FREE_EXTENDED_MEMORY 0x08
54 #define XMS_ALLOCATE_EXTENDED_MEMORY 0x09
55 #define XMS_FREE_EXTENDED_MEMORY 0x0a
56 #define XMS_MOVE_EXTENDED_MEMORY_BLOCK 0x0b
57 #define XMS_LOCK_EXTENDED_MEMORY_BLOCK 0x0c
58 #define XMS_UNLOCK_EXTENDED_MEMORY_BLOCK 0x0d
59 #define XMS_GET_EMB_HANDLE_INFORMATION 0x0e
60 #define XMS_RESIZE_EXTENDED_MEMORY_BLOCK 0x0f
61 #define XMS_ALLOCATE_UMB 0x10
62 #define XMS_DEALLOCATE_UMB 0x11
63 #define XMS_REALLOCATE_UMB 0x12
64 /* New functions for values bigger than 65MB, not implented yet */
65 #define XMS_QUERY_FREE_EXTENDED_MEMORY_LARGE 0x88
66 #define XMS_ALLOCATE_EXTENDED_MEMORY_LARGE 0x89
67 #define XMS_FREE_EXTENDED_MEMORY_LARGE 0x8a
70 /* XMS error return codes */
71 #define XMS_SUCCESS 0x0
72 #define XMS_NOT_IMPLEMENTED 0x80
73 #define XMS_VDISK 0x81 /* If vdisk.sys is present */
74 #define XMS_A20_ERROR 0x82
75 #define XMS_GENERAL_ERROR 0x8e
76 #define XMS_HMA_NOT_MANAGED 0x90
77 #define XMS_HMA_ALREADY_USED 0x91
78 #define XMS_HMA_NOT_ALLOCATED 0x93
79 #define XMS_A20_STILL_ENABLED 0x94
80 #define XMS_FULL 0xa0
81 #define XMS_OUT_OF_HANDLES 0xa1
82 #define XMS_INVALID_HANDLE 0xa2
83 #define XMS_INVALID_SOURCE_HANDLE 0xa3
84 #define XMS_INVALID_SOURCE_OFFSET 0xa4
85 #define XMS_INVALID_DESTINATION_HANDLE 0xa5
86 #define XMS_INVALID_DESTINATION_OFFSET 0xa6
87 #define XMS_INVALID_LENGTH 0xa7
88 #define XMS_BLOCK_NOT_LOCKED 0xaa
89 #define XMS_BLOCK_IS_LOCKED 0xab
90 #define XMS_BLOCK_LOCKCOUNT_OVERFLOW 0xac
91 #define XMS_REQUESTED_UMB_TOO_BIG 0xb0
92 #define XMS_NO_UMBS_AVAILABLE 0xb1
93 #define XMS_INVALID_UMB_SEGMENT 0xb2
97 * EMM structure for data exchange with DOS caller, hence the
98 * packed format
101 struct EMM {
102 u_long nbytes;
103 u_short src_handle __attribute__ ((packed));
104 u_long src_offset __attribute__ ((packed));
105 u_short dst_handle __attribute__ ((packed));
106 u_long dst_offset __attribute__ ((packed));
110 * XMS info structure, only used to pass information to and from
111 * DOS
114 struct XMSinfo {
115 u_char handle; /* the handle */
116 u_char num_locks; /* number of locks */
117 u_long size; /* size of memory */
118 u_long phys_addr; /* "physical" address */
119 } __packed;
122 * Handle management inside the emulator for extendend memory pages,
123 * invisible to DOS
126 typedef struct {
127 u_long addr; /* address inside emulator, from malloc() */
128 u_long size; /* size in bytes */
129 u_char num_locks; /* lock count for this handle */
130 } XMS_handle;
133 * Managment of UMB memory paragraphs (16 bytes). UMB blocks are
134 * directly accessible by VM86 applications and lie between 0xd0000 and
135 * 0xefff0 in VM86 memory space.
138 struct _UMB_block {
139 u_long addr; /* Start address of block */
140 u_long size; /* Size in bytes */
141 struct _UMB_block *next;
144 typedef struct _UMB_block UMB_block;
146 #endif /* XMS_H */