Intel ARCHITECTURE IA-32 User Manual Page 589

  • Download
  • Add to my manuals
  • Print
  • Page
    / 636
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 588
Vol. 3A 16-9
MIXING 16-BIT AND 32-BIT CODE
The interface procedure becomes more complex if any of these rules are violated. For example,
if a 16-bit procedure calls a 32-bit procedure with an entry point beyond FFFFH, the interface
procedure will need to provide the offset to the entry point. The mapping between 16- and 32-bit
addresses is only performed automatically when a call gate is used, because the gate descriptor
for a call gate contains a 32-bit address. When a call gate is not used, the interface code must
provide the 32-bit address.
The structure of the interface procedure depends on the types of calls it is going to support, as
follows:
Calls from 16-bit procedures to 32-bit procedures — Calls to the interface procedure
from a 16-bit code segment are made with 16-bit CALL instructions (by default, because
the D flag for the calling code-segment descriptor is clear), and 16-bit operand-size
prefixes are used with RET instructions to return from the interface procedure to the
calling procedure. Calls from the interface procedure to 32-bit procedures are performed
with 32-bit CALL instructions (by default, because the D flag for the interface procedure’s
code segment is set), and returns from the called procedures to the interface procedure are
performed with 32-bit RET instructions (also by default).
Calls from 32-bit procedures to 16-bit procedures — Calls to the interface procedure
from a 32-bit code segment are made with 32-bit CALL instructions (by default), and
returns to the calling procedure from the interface procedure are made with 32-bit RET
instructions (also by default). Calls from the interface procedure to 16-bit procedures
require the CALL instructions to have the operand-size prefixes, and returns from the
called procedures to the interface procedure are performed with 16-bit RET instructions
(by default).
Page view 588
1 2 ... 584 585 586 587 588 589 590 591 592 593 594 ... 635 636

Comments to this Manuals

No comments