-
Notifications
You must be signed in to change notification settings - Fork 165
/
Copy pathdpmi.h
995 lines (919 loc) · 28.4 KB
/
dpmi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
/****************************************************************************
*
* Open Watcom Project
*
* Copyright (c) 2002-2022 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: DPMI API int 31h wrappers.
*
****************************************************************************/
#ifndef __DPMI_H
#define __DPMI_H
#include "watcom.h"
#include "descript.h"
#define VECTOR_DPMI 0x31
typedef struct {
uint_32 edi;
uint_32 esi;
uint_32 ebp;
uint_32 reserved;
uint_32 ebx;
uint_32 edx;
uint_32 ecx;
uint_32 eax;
uint_16 flags;
uint_16 es;
uint_16 ds;
uint_16 fs;
uint_16 gs;
uint_16 ip;
uint_16 cs;
uint_16 sp;
uint_16 ss;
} rm_call_struct;
typedef struct {
uint_32 largest_free;
uint_32 max_unlocked_page_alloc;
uint_32 max_locked_page_alloc;
uint_32 linear_addr_space_in_pages;
uint_32 total_unlocked_pages;
uint_32 free_pages;
uint_32 physical_pages;
uint_32 free_linear_addr_space_in_pages;
uint_32 size_of_page_file_in_pages;
uint_32 fill[4];
} dpmi_mem;
typedef struct {
uint_8 major_version;
uint_8 minor_version;
int_16 flags;
uint_8 processor_type;
uint_8 master_pic_base_interrupt;
uint_8 slave_pic_base_interrupt;
} version_info;
#define VERSION_80386 0x0001
typedef enum {
DPMI_WATCH_EXEC,
DPMI_WATCH_WRITE,
DPMI_WATCH_READWRITE
} dpmi_watch_type;
typedef struct {
uint_32 linear;
uint_32 handle;
} dpmi_mem_block;
typedef struct {
uint_16 rm;
uint_16 pm;
} dpmi_dos_block;
#define DPMISetWatch _DPMISetWatch
#define DPMIClearWatch _DPMIClearWatch
#define DPMITestWatch _DPMITestWatch
#define DPMIResetWatch _DPMIResetWatch
#define DPMIFreeMemoryBlock _DPMIFreeMemoryBlock
#define DPMILockLinearRegion _DPMILockLinearRegion
#define DPMIUnlockLinearRegion _DPMIUnlockLinearRegion
#define DPMIGetDescriptor _DPMIGetDescriptor
#define DPMISetDescriptor _DPMISetDescriptor
#define DPMICreateCodeSegmentAliasDescriptor _DPMICreateCodeSegmentAliasDescriptor
#define DPMIAllocateLDTDescriptors _DPMIAllocateLDTDescriptors
#define DPMISegmentToDescriptor _DPMISegmentToDescriptor
#define DPMIFreeLDTDescriptor _DPMIFreeLDTDescriptor
#define DPMIGetSegmentBaseAddress _DPMIGetSegmentBaseAddress
#define DPMISetSegmentBaseAddress _DPMISetSegmentBaseAddress
#define DPMISetSegmentLimit _DPMISetSegmentLimit
#define DPMISetDescriptorAccessRights _DPMISetDescriptorAccessRights
#define DPMISimulateRealModeInterrupt _DPMISimulateRealModeInterrupt
#define DPMIGetNextSelectorIncrementValue _DPMIGetNextSelectorIncrementValue
#define DPMIGetRealModeInterruptVector _DPMIGetRealModeInterruptVector
#define DPMISetRealModeInterruptVector _DPMISetRealModeInterruptVector
#define DPMIAllocateRealModeCallBackAddress _DPMIAllocateRealModeCallBackAddress
#define DPMIFreeRealModeCallBackAddress _DPMIFreeRealModeCallBackAddress
#define DPMIGetPMInterruptVector _DPMIGetPMInterruptVector
#define DPMISetPMInterruptVector _DPMISetPMInterruptVector
#define DPMISetPMExceptionVector _DPMISetPMExceptionVector
#define DPMIGetPMExceptionVector _DPMIGetPMExceptionVector
#define DPMIAllocateDOSMemoryBlock _DPMIAllocateDOSMemoryBlock
#define DPMIFreeDOSMemoryBlock _DPMIFreeDOSMemoryBlock
#define DPMIIdle _DPMIIdle
#define DPMIModeDetect _DPMIModeDetect
#define DPMIRawRMtoPMAddr _DPMIRawRMtoPMAddr
#define DPMIRawPMtoRMAddr _DPMIRawPMtoRMAddr
#define DPMISaveRMStateAddr _DPMISaveRMStateAddr
#define DPMISavePMStateAddr _DPMISavePMStateAddr
#define DPMISaveStateSize _DPMISaveStateSize
#define DPMIGetVendorSpecificAPI _DPMIGetVendorSpecificAPI
#if defined( _M_I86SM ) || defined( _M_I86MM ) || defined( __386__ )
#if defined(__386__)
#define DPMIGetVersion _DPMIGetVersion
#else
#define DPMIGetVersion _nDPMIGetVersion
#endif
#define DPMIAllocateMemoryBlock _nDPMIAllocateMemoryBlock
#define DPMIGetFreeMemoryInformation _nDPMIGetFreeMemoryInformation
#define DPMIResizeMemoryBlock _nDPMIResizeMemoryBlock
#else
#define DPMIGetVersion _fDPMIGetVersion
#define DPMIAllocateMemoryBlock _fDPMIAllocateMemoryBlock
#define DPMIGetFreeMemoryInformation _fDPMIGetFreeMemoryInformation
#define DPMIResizeMemoryBlock _fDPMIResizeMemoryBlock
#endif
extern void _DPMIFreeRealModeCallBackAddress( void __far * proc );
extern void __far *_DPMIAllocateRealModeCallBackAddress( void __far * proc, rm_call_struct __far *cs );
extern void __far *_DPMIGetRealModeInterruptVector( uint_8 iv );
extern int _DPMISetPMInterruptVector( uint_8 iv, void __far * ptr );
extern void _DPMISetPMExceptionVector( uint_8 iv, void __far * ptr );
extern void __far *_DPMIGetPMExceptionVector( uint_8 iv );
extern void __far *_DPMIGetPMInterruptVector( uint_8 iv );
extern int _DPMISetRealModeInterruptVector( uint_8 iv, void __far * ptr );
extern int_16 _DPMIModeDetect( void );
extern void _DPMIIdle( void );
extern void _DPMIGetVersion( version_info __far * );
extern void _fDPMIGetVersion( version_info __far * );
extern void _nDPMIGetVersion( version_info * );
extern int_32 _DPMIAllocateLDTDescriptors( uint_16 );
extern int_32 _DPMISegmentToDescriptor( uint_16 );
extern int _DPMIFreeLDTDescriptor( uint_16 );
extern uint_16 _DPMIGetNextSelectorIncrementValue( void );
extern uint_32 _DPMIGetSegmentBaseAddress( uint_16 );
extern int _DPMISetSegmentBaseAddress( uint_16, uint_32 );
extern int _DPMISetSegmentLimit( uint_16, uint_32 );
extern int _DPMISetDescriptorAccessRights( uint_16, uint_16 );
extern int_16 _fDPMIAllocateMemoryBlock( dpmi_mem_block __far *, uint_32 );
extern int_16 _nDPMIAllocateMemoryBlock( dpmi_mem_block *, uint_32 );
extern int_16 _fDPMIResizeMemoryBlock( dpmi_mem_block __far *, uint_32, uint_32 );
extern int_16 _nDPMIResizeMemoryBlock( dpmi_mem_block *, uint_32, uint_32 );
extern int _DPMIFreeMemoryBlock( uint_32 );
extern int _DPMILockLinearRegion( uint_32, uint_32 );
extern int _DPMIUnlockLinearRegion( uint_32, uint_32 );
extern int _DPMIGetDescriptor( uint_16, descriptor __far * );
extern int _DPMISetDescriptor( uint_16, descriptor __far * );
extern int_32 _DPMICreateCodeSegmentAliasDescriptor( uint_16 );
extern int _nDPMIGetFreeMemoryInformation( dpmi_mem * );
extern int _fDPMIGetFreeMemoryInformation( dpmi_mem __far * );
extern int _DPMISimulateRealModeInterrupt( uint_8 interrupt, uint_8 flags,
uint_16 words_to_copy, rm_call_struct __far *call_st );
extern dpmi_dos_block _DPMIAllocateDOSMemoryBlock( uint_16 para );
extern int _DPMIFreeDOSMemoryBlock( uint_16 sel );
extern void __far *_DPMIRawPMtoRMAddr( void );
extern uint_32 _DPMIRawRMtoPMAddr( void );
extern void __far *_DPMISaveRMStateAddr( void );
extern uint_32 _DPMISavePMStateAddr( void );
extern uint_16 _DPMISaveStateSize( void );
extern void __far *_DPMIGetVendorSpecificAPI( char __far * );
extern int_32 _DPMISetWatch( uint_32 linear, uint_8 len, uint_8 type );
extern int _DPMIClearWatch( uint_16 handle );
extern int _DPMITestWatch( uint_16 handle );
extern int _DPMIResetWatch( uint_16 handle );
#pragma aux _DPMIIdle = \
"mov ax,1680h" \
"int 2fh" \
__parm [] \
__value \
__modify __exact [__ax]
#pragma aux _DPMIModeDetect = \
"mov ax,1686h" \
"int 2fh" \
__parm [] \
__value [__ax] \
__modify __exact [__ax]
#if defined(__386__)
#pragma aux _DPMISetWatch = \
"mov ax,0b00h" \
"mov cx,bx" \
"shr ebx,16" \
"int 31h" \
"sbb eax,eax" \
"mov ax,bx" \
__parm [__ebx] [__dl] [__dh] \
__value [__eax] \
__modify __exact [__eax __ebx __ecx]
#else
#pragma aux _DPMISetWatch = \
"mov ax,0b00h" \
"xchg bx,cx" \
"int 31h" \
"sbb cx,cx" \
__parm [__bx __cx] [__dl] [__dh] \
__value [__cx __bx] \
__modify __exact [__ax __bx __cx]
#endif
#if defined(__386__)
#pragma aux _DPMIClearWatch = \
"mov ax,0b01h" \
"int 31h" \
"sbb eax,eax" \
__parm [__bx] \
__value [__eax] \
__modify __exact [__eax]
#else
#pragma aux _DPMIClearWatch = \
"mov ax,0b01h" \
"int 31h" \
"sbb ax,ax" \
__parm [__bx] \
__value [__ax] \
__modify __exact [__ax]
#endif
#if defined(__386__)
#pragma aux _DPMITestWatch = \
"mov ax,0b02h" \
"int 31h" \
"sbb ebx,ebx" \
"and eax,1" \
"or ebx,eax" \
__parm [__bx] \
__value [__ebx] \
__modify __exact [__eax __ebx]
#else
#pragma aux _DPMITestWatch = \
"mov ax,0b02h" \
"int 31h" \
"sbb bx,bx" \
"and ax,1" \
"or bx,ax" \
__parm [__bx] \
__value [__bx] \
__modify __exact [__ax __bx]
#endif
#if defined(__386__)
#pragma aux _DPMIResetWatch = \
"mov ax,0b03h" \
"int 31h" \
"sbb eax,eax" \
__parm [__bx] \
__value [__eax] \
__modify __exact [__eax]
#else
#pragma aux _DPMIResetWatch = \
"mov ax,0b03h" \
"int 31h" \
"sbb ax,ax" \
__parm [__bx] \
__value [__ax] \
__modify __exact [__ax]
#endif
#if defined(__386__)
#pragma aux _DPMIGetVersion = \
"push ds" \
"mov ds,edx" \
"mov ax,400h" \
"int 31h" \
"mov byte ptr [esi],ah" \
"mov byte ptr [esi+1],al" \
"mov word ptr [esi+2],bx" \
"mov byte ptr [esi+4],cl" \
"mov byte ptr [esi+5],dh" \
"mov byte ptr [esi+6],dl" \
"pop ds" \
__parm [__dx __esi] \
__value \
__modify[__ax __bx __cl __dx]
#else
#pragma aux _nDPMIGetVersion = \
"mov ax,400h" \
"int 31h" \
"mov byte ptr [si],ah" \
"mov byte ptr [si+1],al" \
"mov word ptr [si+2],bx" \
"mov byte ptr [si+4],cl" \
"mov byte ptr [si+5],dh" \
"mov byte ptr [si+6],dl" \
__parm [__si] \
__value \
__modify[__ax __bx __cl __dx]
#pragma aux _fDPMIGetVersion = \
"mov ax,400h" \
"int 31h" \
"mov byte ptr es:[si],ah" \
"mov byte ptr es:[si+1],al" \
"mov word ptr es:[si+2],bx" \
"mov byte ptr es:[si+4],cl" \
"mov byte ptr es:[si+5],dh" \
"mov byte ptr es:[si+6],dl" \
__parm [__es __si] \
__value \
__modify[__ax __bx __cl __dx]
#endif
#if defined(__386__)
#pragma aux _DPMIAllocateLDTDescriptors = \
"xor eax,eax" \
"int 31h" \
"sbb ecx,ecx" \
"mov cx,ax" \
__parm [__cx] \
__value [__ecx] \
__modify __exact [__eax __ecx]
#else
#pragma aux _DPMIAllocateLDTDescriptors = \
"xor ax,ax" \
"int 31h" \
"sbb cx,cx" \
__parm [__cx] \
__value [__cx __ax] \
__modify __exact [__ax __cx]
#endif
#if defined(__386__)
#pragma aux _DPMIFreeLDTDescriptor = \
"mov ax,1" \
"int 31h" \
"sbb eax,eax" \
__parm [__bx] \
__value [__eax] \
__modify __exact [__eax]
#else
#pragma aux _DPMIFreeLDTDescriptor = \
"mov ax,1" \
"int 31h" \
"sbb ax,ax" \
__parm [__bx] \
__value [__ax] \
__modify __exact [__ax]
#endif
#if defined(__386__)
#pragma aux _DPMISegmentToDescriptor = \
"mov ax,2" \
"int 31h" \
"sbb ebx,ebx" \
"mov bx,ax" \
__parm [__bx] \
__value [__ebx]\
__modify __exact [__ax __ebx]
#else
#pragma aux _DPMISegmentToDescriptor = \
"mov ax,2" \
"int 31h" \
"sbb bx,bx" \
__parm [__bx] \
__value [__bx __ax] \
__modify __exact [__ax __bx]
#endif
#pragma aux _DPMIGetNextSelectorIncrementValue = \
"mov ax,3" \
"int 31h" \
__parm [__bx] \
__value [__ax] \
__modify __exact [__ax]
#if defined(__386__)
#pragma aux _DPMIGetSegmentBaseAddress = \
"mov ax,6" \
"int 31h" \
"shl ecx,16" \
"mov cx,dx" \
__parm __caller [__bx] \
__value [__ecx] \
__modify __exact [__ax __ecx __edx]
#else
#pragma aux _DPMIGetSegmentBaseAddress = \
"mov ax,6" \
"int 31h" \
__parm [__bx] \
__value[__cx __dx] \
__modify __exact [__ax __cx __dx]
#endif
#if defined(__386__)
#pragma aux _DPMISetSegmentBaseAddress = \
"mov ax,7" \
"mov dx,cx" \
"shr ecx,16" \
"int 31h" \
"sbb eax,eax" \
__parm [__bx] [__ecx] \
__value [__eax] \
__modify __exact [__eax __ecx __dx]
#else
#pragma aux _DPMISetSegmentBaseAddress = \
"mov ax,7" \
"int 31h" \
"sbb ax,ax" \
__parm [__bx] [__cx __dx] \
__value [__ax] \
__modify __exact [__ax]
#endif
#if defined(__386__)
#pragma aux _DPMISetSegmentLimit = \
"mov dx,cx" \
"shr ecx,16" \
"mov ax,8" \
"int 31h" \
"sbb eax,eax" \
__parm [__bx] [__ecx] \
__value [__eax] \
__modify __exact [__eax __ecx __dx]
#else
#pragma aux _DPMISetSegmentLimit = \
"mov ax,8" \
"int 31h" \
"sbb ax,ax" \
__parm [__bx] [__cx __dx] \
__value [__ax] \
__modify __exact [__ax]
#endif
#if defined(__386__)
#pragma aux _DPMISetDescriptorAccessRights = \
"mov ax,9" \
"int 31h" \
"sbb eax,eax" \
__parm [__bx] [__cx] \
__value [__eax] \
__modify __exact [__eax]
#else
#pragma aux _DPMISetDescriptorAccessRights = \
"mov ax,9" \
"int 31h" \
"sbb ax,ax" \
__parm [__bx] [__cx] \
__value [__ax] \
__modify __exact [__ax]
#endif
#if defined(__386__)
#pragma aux _DPMIFreeMemoryBlock = \
"mov di,si" \
"shr esi,16" \
"mov ax,502h" \
"int 31h" \
"sbb eax,eax" \
__parm [__esi] \
__value [__eax] \
__modify __exact [__eax __di __esi]
#else
#pragma aux _DPMIFreeMemoryBlock = \
"xchg si,di" \
"mov ax,502h" \
"int 31h" \
"sbb ax,ax" \
__parm [__di __si] \
__value [__ax] \
__modify __exact [__ax __di __si]
#endif
#if defined(__386__)
#pragma aux _DPMILockLinearRegion = \
"mov di,si" \
"shr esi,16" \
"mov cx,bx" \
"shr ebx,16" \
"mov ax,600h" \
"int 31h" \
"sbb eax,eax" \
__parm [__ebx] [__esi] \
__value [__eax] \
__modify __exact [__eax __ebx __cx __esi __di]
#pragma aux _DPMIUnlockLinearRegion = \
"mov di,si" \
"shr esi,16" \
"mov cx,bx" \
"shr ebx,16" \
"mov ax,601h" \
"int 31h" \
"sbb eax,eax" \
__parm [__ebx] [__esi] \
__value [__eax] \
__modify __exact [__eax __ebx __cx __esi __di]
#else
#pragma aux _DPMILockLinearRegion = \
"mov ax,600h" \
"int 31h" \
"sbb ax,ax" \
__parm [__cx __bx] [__si __di] \
__value[__ax] \
__modify __exact [__ax]
#pragma aux _DPMIUnlockLinearRegion = \
"mov ax,601h" \
"int 31h" \
"sbb ax,ax" \
__parm [__cx __bx] [__si __di] \
__value [__ax] \
__modify __exact [__ax]
#endif
#if defined(__386__)
#pragma aux _DPMIAllocateDOSMemoryBlock = \
"mov ax,100h" \
"int 31h" \
"jnc short L1" \
"xor ax,ax" \
"xor dx,dx" \
"L1: shl edx,16" \
"mov dx,ax" \
__parm [__bx] \
__value [__edx] \
__modify [__ax __bx __edx]
#pragma aux _DPMIFreeDOSMemoryBlock = \
"mov ax,101h" \
"int 31h" \
"sbb eax,eax" \
__parm [__dx] \
__value [__eax] \
__modify __exact [__eax]
#pragma aux _DPMISimulateRealModeInterrupt = \
"push es" \
"mov es,edx" \
"mov ax,300h" \
"int 31h" \
"pop es" \
"sbb eax,eax" \
__parm [__bl] [__bh] [__cx] [__dx __edi] \
__value [__eax] \
__modify []
#pragma aux _DPMICreateCodeSegmentAliasDescriptor = \
"mov ax,0ah" \
"int 31h" \
"sbb ebx,ebx" \
"mov bx,ax" \
__parm [__bx] \
__value [__ebx] \
__modify __exact [__eax __ebx]
#pragma aux _DPMIGetDescriptor = \
"push es" \
"mov es,edx" \
"mov ax,0bh" \
"int 31h" \
"pop es" \
"sbb eax,eax" \
__parm [__bx] [__dx __edi] \
__value [__eax] \
__modify []
#pragma aux _DPMISetDescriptor = \
"push es" \
"mov es,edx" \
"mov ax,0ch" \
"int 31h" \
"pop es" \
"sbb eax,eax" \
__parm [__bx] [__dx __edi] \
__value [__eax] \
__modify []
#else
#pragma aux _DPMIAllocateDOSMemoryBlock = \
"mov ax,100h" \
"int 31h" \
"jnc short L1" \
"xor ax,ax" \
"xor dx,dx" \
"L1: " \
__parm [__bx] \
__value [__dx __ax] \
__modify __exact [__ax __bx __dx]
#pragma aux _DPMIFreeDOSMemoryBlock = \
"mov ax,101h" \
"int 31h" \
"sbb ax,ax" \
__parm [__dx] \
__value [__ax] \
__modify __exact [__ax]
#pragma aux _DPMISimulateRealModeInterrupt = \
"mov ax,300h" \
"int 31h" \
"sbb ax,ax" \
__parm [__bl] [__bh] [__cx] [__es __di] \
__value [__ax] \
__modify []
#pragma aux _DPMICreateCodeSegmentAliasDescriptor = \
"mov ax,0ah" \
"int 31h" \
"sbb bx,bx" \
__parm [__bx] \
__value [__bx __ax] \
__modify __exact[__ax __bx]
#pragma aux _DPMIGetDescriptor = \
"mov ax,0bh" \
"int 31h" \
"sbb ax,ax" \
__parm [__bx] [__es __di] \
__value [__ax] \
__modify []
#pragma aux _DPMISetDescriptor = \
"mov ax,0ch" \
"int 31h" \
"sbb ax,ax" \
__parm [__bx] [__es __di] \
__value [__ax] \
__modify []
#endif
#pragma aux _fDPMIAllocateMemoryBlock = \
"push es" \
"push ax" \
"push dx" \
"xchg bx,cx" \
"mov ax,501H" \
"int 31h" \
"sbb ax,ax" \
"mov dx,bx" \
"pop es" \
"pop bx" \
"mov es:[bx],cx" \
"mov es:+2H[bx],dx" \
"mov es:+4H[bx],di" \
"mov es:+6H[bx],si" \
"pop es" \
__parm [__ax __dx] [__bx __cx] \
__value [__ax] \
__modify [__bx __cx __dx __di __si]
#pragma aux _nDPMIAllocateMemoryBlock = \
"push ax" \
"xchg bx,cx" \
"mov ax,501H" \
"int 31h" \
"sbb ax,ax" \
"mov dx,bx" \
"pop bx" \
"mov ds:[bx],cx" \
"mov ds:+2H[bx],dx" \
"mov ds:+4H[bx],di" \
"mov ds:+6H[bx],si" \
__parm [__ax] [__bx __cx] \
__value [__ax] \
__modify [__bx __cx __dx __di __si]
#pragma aux _fDPMIResizeMemoryBlock = \
"push es" \
"push ax" \
"push dx" \
"xchg si,di" \
"xchg bx,cx" \
"mov ax,503h" \
"int 31h" \
"sbb ax,ax" \
"mov dx,bx" \
"pop es" \
"pop bx" \
"mov es:[bx],cx" \
"mov es:+2H[bx],dx" \
"mov es:+4H[bx],di" \
"mov es:+6H[bx],si" \
"pop es" \
__parm [__dx __ax] [__bx __cx] [__di __si] \
__value [__ax] \
__modify [__di __si __bx __cx __dx]
#pragma aux _nDPMIResizeMemoryBlock = \
"push ax" \
"xchg si,di" \
"xchg bx,cx" \
"mov ax,503h" \
"int 31h" \
"sbb ax,ax" \
"mov dx,bx" \
"pop bx" \
"mov ds:[bx],cx" \
"mov ds:+2H[bx],dx" \
"mov ds:+4H[bx],di" \
"mov ds:+6H[bx],si" \
__parm [__ax] [__bx __cx] [__di __si] \
__value [__ax] \
__modify [__di __si __bx __cx __dx]
#if defined(__386__)
#pragma aux _nDPMIGetFreeMemoryInformation = \
"push es" \
"push ds" \
"pop es" \
"mov ax,500h" \
"int 31h" \
"pop es" \
"sbb eax,eax" \
__parm [__edi] \
__value [__eax] \
__modify __exact [__eax]
#else
#pragma aux _fDPMIGetFreeMemoryInformation = \
"mov ax,500h" \
"int 31h" \
"sbb ax,ax" \
__parm [__es __di] \
__value [__ax] \
__modify __exact [__ax]
#pragma aux _nDPMIGetFreeMemoryInformation = \
"push es" \
"push ds" \
"pop es" \
"mov ax,500h" \
"int 31h" \
"pop es" \
"sbb ax,ax" \
__parm [__di] \
__value [__ax] \
__modify __exact [__ax]
#endif
#if defined(__386__)
#pragma aux _DPMIGetRealModeInterruptVector = \
"mov ax,200h" \
"int 31h" \
__parm [__bl] \
__value [__cx __edx] \
__modify [__ax]
#pragma aux _DPMISetRealModeInterruptVector = \
"mov ax,201h" \
"int 31h" \
"sbb eax,eax" \
__parm [__bl] [__cx __edx] \
__value [__eax] \
__modify []
#else
#pragma aux _DPMIGetRealModeInterruptVector = \
"mov ax,200h" \
"int 31h" \
__parm [__bl] \
__value [__cx __dx] \
__modify [__ax]
#pragma aux _DPMISetRealModeInterruptVector = \
"mov ax,201h" \
"int 31h" \
"sbb ax,ax" \
__parm [__bl] [__cx __dx] \
__value [__ax] \
__modify []
#endif
#if defined(__386__)
#pragma aux _DPMIGetPMExceptionVector = \
"mov ax,202h" \
"int 31h" \
__parm [__bl] \
__value [__cx __edx] \
__modify [__ax]
#pragma aux _DPMISetPMExceptionVector = \
"mov ax,203h" \
"int 31h" \
__parm [__bl] [__cx __edx] \
__value \
__modify [__ax]
#pragma aux _DPMIGetPMInterruptVector = \
"mov ax,204h" \
"int 31h" \
__parm [__bl] \
__value [__cx __edx] \
__modify [__ax]
#pragma aux _DPMISetPMInterruptVector = \
"mov ax,205h" \
"int 31h" \
"sbb eax,eax" \
__parm [__bl] [__cx __edx] \
__value [__eax] \
__modify []
#else
#pragma aux _DPMIGetPMExceptionVector = \
"mov ax,202h" \
"int 31h" \
__parm [__bl] \
__value [__cx __dx] \
__modify [__ax]
#pragma aux _DPMISetPMExceptionVector = \
"mov ax,203h" \
"int 31h" \
__parm [__bl] [__cx __dx] \
__value \
__modify [__ax]
#pragma aux _DPMIGetPMInterruptVector = \
"mov ax,204h" \
"int 31h" \
__parm [__bl] \
__value [__cx __dx] \
__modify [__ax]
#pragma aux _DPMISetPMInterruptVector = \
"mov ax,205h" \
"int 31h" \
"sbb ax,ax" \
__parm [__bl] [__cx __dx] \
__value [__ax] \
__modify []
#endif
#if defined(__386__)
#pragma aux _DPMIAllocateRealModeCallBackAddress = \
"push es" \
"push ds" \
"mov ds,edx" \
"mov esi,eax" \
"mov es,ecx" \
"mov edi,ebx" \
"mov ax,303h" \
"int 31h" \
"pop ds" \
"pop es" \
__parm [__dx __eax] [__cx __ebx] \
__value [__cx __edx] \
__modify [__edi __esi]
#pragma aux _DPMIFreeRealModeCallBackAddress = \
"mov ax,304h" \
"int 31h" \
__parm [__cx __edx] \
__value \
__modify []
#else
#pragma aux _DPMIAllocateRealModeCallBackAddress = \
"push ds" \
"mov ds,dx" \
"mov si,ax" \
"mov ax,303h" \
"int 31h" \
"pop ds" \
__parm [__dx __ax] [__es __di] \
__value [__cx __dx] \
__modify [__si]
#pragma aux _DPMIFreeRealModeCallBackAddress = \
"mov ax,304h" \
"int 31h" \
__parm [__cx __dx] \
__value \
__modify []
#endif
#if defined(__386__)
#pragma aux _DPMIRawPMtoRMAddr = \
"mov ax,306h" \
"xor edi,edi" \
"stc" \
"int 31h" \
"mov cx,si" \
"jnc short L1" \
"xor cx,cx" \
"xor edi,edi" \
"L1: " \
__parm [] \
__value [__cx __edi] \
__modify __exact [__eax __cx __si __edi]
#pragma aux _DPMIRawRMtoPMAddr = \
"mov ax,306h" \
"stc" \
"int 31h" \
"jnc short L1" \
"xor ebx,ebx" \
"jmp short L2" \
"L1: shl ebx,16" \
"mov bx,cx" \
"L2: " \
__parm [] \
__value [__ebx] \
__modify __exact [__eax __cx __si __edi]
#pragma aux _DPMISaveRMStateAddr = \
"mov ax,305h" \
"stc" \
"int 31h" \
"mov cx,si" \
"jnc short L1" \
"xor cx,cx" \
"xor edi,edi" \
"L1: " \
__parm [] \
__value [__cx __edi] \
__modify __exact [__ax __bx __cx __si __edi]
#pragma aux _DPMISavePMStateAddr = \
"mov ax,305h" \
"int 31h" \
"jnc short L1" \
"xor cx,cx" \
"xor ebx,ebx" \
"jmp short L2" \
"L1: shl ebx,16" \
"mov bx,cx" \
"L2: " \
__parm [] \
__value [__ebx] \
__modify __exact [__ax __bx __cx __si __edi]
#pragma aux _DPMISaveStateSize = \
"mov ax,305h" \
"int 31h" \
"jnc short L1" \
"xor eax,eax" \
"L1:" \
__parm [] \
__value [__ax] \
__modify __exact [__eax __bx __cx __si __edi]
#pragma aux _DPMIGetVendorSpecificAPI = \
"push ds" \
"push es" \
"push fs" \
"push gs" \
"push ebp" \
"mov ds,ecx" \
"xor eax,eax" \
"mov ah,0ah" \
"int 31h" \
"mov ecx,es" \
"jnc short L1" \
"xor ecx,ecx" \
"xor edi,edi" \
"L1: pop ebp" \
"pop gs" \
"pop fs" \
"pop es" \
"pop ds" \
__parm [__cx __esi] \
__value [__cx __edi] \
__modify [__eax __ebx __ecx __edx __esi]
#endif
#endif