;       SCCSID = @(#)msp32a.asm 6.1 90/11/17
SCCSID  equ "@(#)msp32.asm      1.3 90/09/17"


;***  Change History
;***   noto  11/18/93  Define which segment for Page Tuning DLL   ***
;***                                                              ***


.xlist
include mi.inc
include basemaca.inc
include selxport.inc
include infoseg.inc
include dc1segs.inc
include osmaca.inc
include bsexcpt.inc
include bsetib.inc
.list

.386
CpuMode 386

EXTRN32 DOS32UNWINDEXCEPTION
extrn   DOS32TIB:ABS


CODE32_TUNE1 SEGMENT DWORD USE32 PUBLIC 'CODE'
CODE32_TUNE1 ENDS
CODE32       SEGMENT DWORD USE32 PUBLIC 'CODE'
CODE32       ENDS





CODE32 segment

        assume  cs:FLAT

?cstype  = ?CS_32bit                            ; Make ArgVar work right

;***LP  _Unwind - Unwind to given exception handler.
;
;       This must be written in assembler because you can't pass
;       labels as parameters in C. Under C V6.0 this procedure would
;       be unnecessary because a try-except clause could be used
;       instead.
;
;       ENTRY   pERegRec - Pointer to handler to stop at
;
;       EXIT    none
;
;       USES    EAX, EBX, ECX, EDX

Procedure _Unwind

ArgVar uw_pERegRec, DWORD

        EnterProc

        CCALL32 DOS32UNWINDEXCEPTION, <[uw_pERegRec], offset FLAT:postUW, 0>

postUW: LeaveProc

        RETC

EndProc _Unwind

CODE32  ENDS




CODE32_TUNE1 segment

        assume  cs:FLAT

;***LP  RegisterEH - Register an exception handler
;
;       This is used by the memory suballocation package.
;
;       ENTRY   pERegRec - Exception Registration Record
;
;       EXIT    none
;
;       USES    EAX, ECX

        ASSUME  DS:FLAT, ES:FLAT, SS:FLAT, FS:NOTHING, GS:NOTHING

Procedure _RegisterEH

ArgVar  reh_pERegRec,DWORD

        EnterProc

        mov     eax, DOS32TIB
        mov     fs, eax
        mov     eax, [reh_pERegRec]
        mov     ecx, fs:[tib_pexchain]
        mov     [eax].prev_structure, ecx
        mov     fs:[tib_pexchain], eax

        LeaveProc
        RETC

EndProc _RegisterEH


;***LP  DeRegisterEH - DeRegister an exception handler
;
;       This is used by the memory suballocation package.
;
;       ENTRY   none
;
;       EXIT    none
;
;       USES    EAX

        ASSUME  DS:FLAT, ES:FLAT, SS:FLAT, FS:NOTHING, GS:NOTHING

Procedure _DeRegisterEH

        EnterProc

        mov     eax, DOS32TIB
        mov     fs, eax
        mov     eax, fs:[tib_pexchain]
        mov     eax, [eax].prev_structure
        mov     fs:[tib_pexchain], eax

        LeaveProc
        RETC

EndProc _DeRegisterEH

CODE32_TUNE1  ENDS

END

