⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 int31.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 4 页
字号:
Pass the following information:
.begpoint $compact
.point AX = 0101H
.point DX = selector of the block to be freed
.endpoint
.np
If the call succeeds, the carry flag is clear.
.np
If the call fails, the carry flag is set and the DOS error code is
returned in AX.
If the incorrect segment was specified, code 09H is returned.
If memory control blocks are damaged, code 07H is returned.
.np
All descriptors allocated for the specified memory block are
deallocated automatically and cannot be accessed correctly after the
block is freed.
.*
.note Function 0102H
.*
.ix 'DPMI' 'resize DOS memory block'
This function resizes a DOS memory block allocated with function
0100H.
Pass the following information:
.begpoint $compact
.point AX = 0102H
.point BX = the number of paragraphs (16-byte blocks) in the resized block
.point DX = selector of block to resize
.endpoint
.np
If the call succeeds, the carry flag is clear.
.np
If the call fails, the carry flag is set, the maximum number of
paragraphs available is returned in BX, and the DOS error code is
returned in AX.
If memory code blocks are damaged, code 07H is returned.
If there isn't enough memory to increase the size as requested, code
08H is returned.
If the incorrect segment is specified, code 09h is returned.
.np
Because of the difficulty of finding additional contiguous memory or
descriptors, this function is not often used to increase the size of a
memory block.
Increasing the size of a memory block might well fail because other
DOS allocations have used contiguous space.
If the next descriptor in the LDT is not free, allocation also fails
when the size of a block grows over the 64KB boundary.
.np
If you shrink the size of a memory block, you may also free some
descriptors allocated to the block.
The initial selector remains unchanged, however; only the limits of
subsequent selectors will change.
.endnote
.*
.section Interrupt Services
.*
.begnote
.*
.note Function 0200H
.*
.ix 'DPMI' 'get real-mode interrupt vector'
.ix 'interrupt services'
This function gets the value of the current task's real-mode interrupt
vector for the specified interrupt.
Pass the following information:
.begpoint $compact
.point AX = 0200H
.point BL = interrupt number
.endpoint
.np
This call always succeeds.
All 100H (256 decimal) interrupt vectors are supported by the host.
When the call returns, the carry flag is clear, and the
.mono segment:offset
of the real-mode interrupt handler is returned in CX:DX.
.np
Because the address returned in CX is a segment, and not a selector,
you cannot put it into a protected-mode segment register.
If you do, a general protection fault may occur.
.*
.note Function 0201H
.*
.ix 'DPMI' 'set real-mode interrupt vector'
This function sets the value of the current task's real-mode interrupt
vector for the specified interrupt.
Pass the following information:
.begpoint $compact
.point AX = 0201H
.point BL = interrupt number
.point CX:DX = segment:offset of the real-mode interrupt handler
.endpoint
.np
If the call succeeds, the carry flag is clear; if it fails, the carry
flag is set.
.np
The address passed in CX:DX should be a real-mode
.mono segment:offset,
such as function 0200H returns.
For this reason, the interrupt handler must reside in DOS addressable
memory.
You can use Function 0100H to allocate DOS memory.
This version does not support the real-mode callback address
function.
.np
If you are hooking a hardware interrupt, you have to lock all segments
involved.
These segments include the segment in which the interrupt handler
runs, and any segment it may touch at interrupt time.
.*
.note Function 0202H
.*
.ix 'DPMI' 'get exception handler vector'
This function gets the processor exception handler vector.
This function returns the CS:EIP of the current protected-mode
exception handler for the specified exception number.
Pass the following information:
.begpoint $compact
.point AX = 0202H
.point BL = exception/fault number (00h - 1Fh)
.endpoint
.np
If the call succeeds, the carry flag is clear and the
.mono selector:offset
of the protected-mode exception handler is returned in CX:EDX.
If it fails, the carry flag is set.
.np
The value returned in CX is a valid protected-mode selector,
not a real-mode segment.
.*
.note Function 0203H
.*
.ix 'DPMI' 'set exception handler vector'
This function sets the processor exception handler vector.
This function allows protected-mode applications to intercept
processor exceptions that are not handled by the DPMI environment.
Programs may wish to handle exceptions such as "not present segment
faults" which would otherwise generate a fatal error.
Pass the following information:
.begpoint $compact
.point AX = 0203H
.point BL = exception/fault number (00h - 1Fh)
.point CX:EDX = selector:offset of the exception handler
.endpoint
.np
If the call succeeds, the carry flag is clear.
If it fails, the carry flag is set.
.np
The address passed in CX must be a valid protected-mode selector, such
as Function 204H returns, and not a real-mode segment.
A 32-bit implementation must supply a 32-bit offset in the EDX
register.
If the handler chains to the next handler, it must use a 32-bit
interrupt stack frame to do so.
.np
The handler should return using a far return instruction.
The original SS:ESP, CS:EIP and flags on the stack, including the
interrupt flag, will be restored.
.np
All fault stack frames have an error code.
However the error code is only valid for exceptions 08h, 0Ah, 0Bh,
0Ch, 0Dh, and 0Eh.
.np
The handler must preserve and restore all registers.
.np
The exception handler will be called on a locked stack with interrupts
disabled.
The original SS, ESP, CS, and EIP will be pushed on the exception
handler stack frame.
.np
The handler must either return from the call by executing a far return
or jump to the next handler in the chain (which will execute a far
return or chain to the next handler).
.np
The procedure can modify any of the values on the stack pertaining
to the exception before returning.
This can be used, for example, to jump to a procedure by modifying
the CS:EIP on the stack.
Note that the procedure must not modify the far return address on the
stack &mdash. it must return to the original caller.
The caller will then restore the flags, CS:EIP and SS:ESP from the
stack frame.
.np
If the DPMI client does not handle an exception, or jumps to the
default exception handler, the host will reflect the exception as an
interrupt for exceptions 0, 1, 2, 3, 4, 5 and 7.
Exceptions 6 and 8 - 1Fh will be treated as fatal errors and the
client will be terminated.
.np
Exception handlers will only be called for exceptions that occur in
protected mode.
.*
.note Function 0204H
.*
.ix 'DPMI' 'get protected-mode interrupt vector'
This function gets the CS:EIP
.mono selector:offset
of the current protected-mode interrupt handler for a specified
interrupt number.
Pass the following information:
.begpoint $compact
.point AX = 0204H
.point BL = interrupt number
.endpoint
.np
This call always succeeds.
All 100H (256 decimal) interrupt vectors are supported by the host.
When the call returns, the carry flag is clear and CX:EDX contains
the protected-mode
.mono selector:offset
of the exception handler.
.np
A 32-bit offset is returned in the EDX register.
.*
.note Function 0205H
.*
.ix 'DPMI' 'set protected-mode interrupt vector'
This function sets the address of the specified protected-mode
interrupt vector.
Pass the following information:
.begpoint $compact
.point AX = 0205H
.point BL = interrupt number
.point CX:EDX = selector:offset of the exception handler
.endpoint
.np
If the call succeeds, the carry flag is clear; if it fails, the carry
flag is set.
.np
The address passed in CX must be a valid protected-mode selector, such
as Function 204H returns, and not a real-mode segment.
A 32-bit implementation must supply a 32-bit offset in the EDX
register.
If the handler chains to the next handler, it must use a 32-bit
interrupt stack frame to do so.
.endnote
.*
.section Translation Services
.*
.np
.ix 'translation services'
These services are provided so that protected-mode programs can call
real-mode software that DPMI does not support directly.
The protected-mode program must set up a data structure with the
appropriate register values.
This "real-mode call structure" is shown below.
.np
.se c0=&INDlvl-1+11
.se c1=&INDlvl-1+19
.se c2=&INDlvl-1+60
.cp 28
.tb set $
.* .tb 9 16 50
.tb &c0 &c1 &c2
.* .bx on 1 8 43
.* .bx on 1 10 50
.se t0=&c0-5
.se t1=&c1-3
.se t2=58
.bx on &t0 &t1 &t2
$Offset$Register
.bx
$00H$EDI
.bx
$04H$ESI
.bx
$08H$EBP
.bx
$0CH$Reserved by system
.bx
$10H$EBX
.bx
$14H$EDX
.bx
$18H$ECX
.bx
$1CH$EAX
.bx
$20H$Flags
.bx
$22H$ES
.bx
$24H$DS
.bx
$26H$FS
.bx
$28H$GS
.bx
$2AH$IP
.bx
$2CH$CS
.bx
$2EH$SP
.bx
$30H$SS
.bx off
.tb set
.tb
.np
After the call or interrupt is complete, all real-mode registers and
flags except SS, SP, CS, and IP will be copied back to the real-mode
call structure so that the caller can examine the real-mode return
values.
.np
The values in the segment registers should be real-mode segments,
not protected-mode selectors.
.np
The translation services will provide a real-mode stack if the SS:SP
fields are zero.
However, the stack provided is relatively small.
If the real-mode procedure/interrupt routine uses more than 30 words
of stack space then you should provide your own real-mode stack.
.begnote
.*
.note Function 0300H
.*
.ix 'DPMI' 'simulate real-mode interrupt'
This function simulates a real-mode interrupt.
This function simulates an interrupt in real mode.
It will invoke the CS:IP specified by the real-mode interrupt
vector and the handler must return by executing an
.mono iret.
Pass the following information:
.begpoint $compact
.point AX = 0300H
.point BL = interrupt number
.point BH = flags
Bit 0 = 1 resets the interrupt controller and A20 line.
Other flags are reserved and must be 0.
.point CX = number of words to copy from protected-mode stack to real-mode stack
.point ES:EDI = the selector:offset of real-mode call structure
.endpoint
.np
If the call fails, the carry flag is set.
.np
If the call succeeds, the carry flag is clear and ES:EDI contains the
.mono selector:offset
of the modified real-mode call structure.
.np
The CS:IP in the real-mode call structure is ignored by this service.
The appropriate interrupt handler will be called based on the value
passed in BL.
.np
The flags specified in the real-mode call structure will be pushed on
the real-mode stack
.mono iret
frame.
The interrupt handler will be called with the interrupt and trace
flags clear.
.np
It is up to the caller to remove any parameters that were pushed on
the protected-mode stack.
.np
The flag to reset the interrupt controller and the A20 line is
ignored by DPMI implementations that run in Virtual 8086 mode.
It causes DPMI implementations that return to real mode to set the
interrupt controller and A20 address line hardware to its normal
real-mode state.
.*
.note Function 0301H
.*
.ix 'DPMI' 'simulate real-mode far call'
(&dos4gprd Professional only)
This function calls a real-mode procedure with a FAR return frame.
The called procedure must execute a FAR return when it completes.
Pass the following information:
.begpoint $compact
.point AX = 0301H
.point BH = flags
Bit 0 = 1 resets the interrupt controller and A20 line.
Other flags reserved and must be 0.
.point CX = Number of words to copy from protected-mode to real-mode stack
.point ES:EDI = selector:offset of real-mode call structure
.endpoint
.np
If the call succeeds, the carry flag is clear and ES:EDI contains the
.mono selector:offset
of modified real-mode call structure.
.np
If the call fails, the carry flag is set.
.autonote Notes:
.note
The CS:IP in the real-mode call structure specifies the address of the
real-mode procedure to call.
.note
The real-mode procedure must execute a FAR return when it has
completed.
.note
If the SS:SP fields are zero then a real-mode stack will be provided
by the DPMI host.
Otherwise, the real-mode SS:SP will be set to the specified values
before the procedure is called.
.note
When the Int 31h returns, the real-mode call structure will contain
the values that were returned by the real-mode procedure.
.note
It is up to the caller to remove any parameters that were pushed on
the protected-mode stack.
.note
The flag to reset the interrupt controller and A20 line is ignored by
DPMI implementations that run in Virtual 8086 mode.
It causes DPMI implementations that return to real mode to set the
interrupt controller and A20 address line hardware to its normal
real-mode state.
.endnote
.*
.note Function 0302H
.*
.ix 'DPMI' 'simulate real-mode iret call'
(&dos4gprd Professional only)
This function calls a real-mode procedure with an
.mono iret
frame.
The called procedure must execute an
.mono iret
when it completes.
Pass the following information:
.begpoint $compact
.point AX = 0302H
.point BH = flags
Bit 0 = 1 resets the interrupt controller and A20 line.
Other flags reserved and must be 0.
.point CX = Number of words to copy from protected-mode to real-mode stack
.point ES:EDI = selector:offset of real-mode call structure
.endpoint
.np
If the call succeeds, the carry flag is clear and ES:EDI contains the
.mono selector:offset
of modified real-mode call structure.
.np
If the call fails, the carry flag is set.
.autonote Notes:
.note
The CS:IP in the real-mode call structure specifies the address of the
real-mode procedure to call.
.note
The real-mode procedure must execute an
.mono iret
when it has completed.
.note
If the SS:SP fields are zero then a real-mode stack will be provided
by the DPMI host. Otherwise, the real-mode SS:SP will be set to the
specified values before the procedure is called.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -