dpmi
TRANSCRIPT
8/12/2019 DPMI
http://slidepdf.com/reader/full/dpmi 1/6
DPMI
What is DPMI
• DOS Protected Mode Interface (DPMI) is an interface which allows a DOS program to
run in protected mode, granting access to many features of the processor not available in
real mode. Almost all DOS extenders are based on DPM and allow DOS programs to
address all memory available in the P! and to run in protected mode.
• was initially developed by Microsoft for "indows #.$
• %his service can be &'(bit, #)(bit, or *universal* and is called the DPMI kernel , DPMI
host , or DPMI server .
• t is provided either by the host operating system +virtual DPMI host or by a DOS
extender +real DPMI host .
How to detect DPMI HOST?
• Using - Int 2FH Fnction !"#$H
%his function can be called in real mode only to test for the presence of a DPM host, and
to obtain an address of a mode switch routine that can be called to begin execution in protected
mode.
• O%tains &ea'-to-Protected Mode Switch ntr Point
• Int 2FH Fnction !"#$H
!alled with A-
eturns
if function unsuccessful (no DPMI host present)
A- / non0ero
If function successful
A- / $1- / flags
!2 / processor type
*a'e Significance
$)3 4$)4'
$#3 4$#4'
8/12/2019 DPMI
http://slidepdf.com/reader/full/dpmi 2/6
$53 4$54'
$63(773 eserved for future ntel processors
The fnction +'so retrns ,
• D3 / DPM ma8or version as a decimal number +represented in binary
D2 / DPM minor version as a decimal number +represented in binary
• S / number of paragraphs re9uired for DPM host private data +may be $
%his is the si0e of a private data area which will be used by the host to hold client(
specific data structures.
• :S;D / segment;offset of procedure to call to enter protected mode
1efore entering protected mode !lient operating in :A2 mode must <
• allocate private data area via normal real mode memory allocation interface as(
1- / S +returned by fn &'4=3
A- / 543
DOS nt )&3
To switch to rotected .ode
• ma>e a 7A !A22 to the mode switch entry point with the following parameters;
• A- / $ since,
/it Significance
$ / &'(bit application
/ #)(bit application
&(&6 eserved, should be 0ero
• :S
s loaded with the base address of real mode segment of DPM host private data area
%hus,
:S ?/ A-
A- ?/ $
!A22 P% mode
8/12/2019 DPMI
http://slidepdf.com/reader/full/dpmi 3/6
Uon retrn ,
• f the !arry flag / & mode switch was unsuccessful, the client is still running in real
mode, A- contains one of the following error codes;
4$&&3 descriptor unavailable +cannot allocate descriptors for !S, DS, :S, SS, PSP,
and environment pointer
4$)&3 invalid value +#)(bit program specified but not supported
• f !arry 7lag / $ the mode switch was successful,
the mode switch routine returns to the call in protected mode the following
results;
&. !S &'(bit selector with base of real mode !S and a '5@1 limit
). SS selector with base of real mode SS and a '5 @1 limit
#. DS selector with base of real mode DS and a '5 @1 limit
5. :S selector to programs PSP with a &$$3 byte limit
6. 7S $ +if running on an 4$#4' or later
'. BS $ +if running on an 4$#4' or later
%he Privileged instructions to be used(
• SMS" CA store machine status word
• !PED get the !PE identification
• S% CA get %
• SBD% CA save BD%
• SD% CA save D%
• S2D% CA save 2D%
8/12/2019 DPMI
http://slidepdf.com/reader/full/dpmi 4/6
0PUID instrction
returns details of the machine
in :A- register as
+ e.g if :A- / F$':!G ( then ( $$ $$ $&&$ &&&$ &&$$
#& &5 &# &) && 4 = 5 # $
Processor %ype $$ 7amily +$&&$ Model +&&&$ Stepping D +&&$$
7or Pentium 7amily <
Model < &&&$
7amily ( $&&$ ( ntel Pentium Pro 7amily
Processor %ype ( for first processor in ntel Pentium Pro 7amily ( F$$G
0&1 , (!-1) MSW
8/12/2019 DPMI
http://slidepdf.com/reader/full/dpmi 5/6
3! !" ! 4 3 2 ! 1
PB H: :% %S :M MP P:
P: < Protected Mode :nabled
MP < Monitor !O Processor
:M( :mulator math +HO 7PE available
%S < %as> Switch
H: < Humeric :rror ( sets native mechanism for reporting 7PE error
:% < :xtension %ype ( 3ardcoded to I&J for P' family of processors
8/12/2019 DPMI
http://slidepdf.com/reader/full/dpmi 6/6
Ott of the rogra. -
• :;KtasmKtasm5Ldpmi&
Machine Status "ord; $$#1
!PE identification; $':!
%as> register; $$)4
Blobal Descriptor table register ; 4&!17$$$ $#77
nterrupt Descriptor table register; 4&!175$$ $=77
2ocal Descriptor table register; $$54
+please note that the output is machine specific