I have an application that requires the interupt 31 save/restore function. At this time, that's just a stub in wine. I propose the following code as a template for a save/restore function. I'm not sure about the whole thing and would like some help please. Thanks. Best regards, Bob Goodwin This code is incomplete and has syntax and other errors. VOID _Int31_SvRestoreHandler() /* this one is just for INTEL */ #ifdef __386__ /* an array to save the context in */ WORD svctx[]; /* return the address of the SaveRestore function */ /* assembly code to get the function call address of SaveRestore() and return the address in the form CX:DX */ VOID SaveRestore() { _GET_CONTEXT; if AL_reg(context) /* AL=1 means restore. AL=0 means save. */ { /* restore all registers */ AL_reg(context)=svctx[0]; /* actually, eax is volatile */ AH_reg(context)=svctx[1]; AL_reg(context)=svctx[2]; AL_reg(context)=svctx[3]; AL_reg(context)=svctx[4]; AL_reg(context)=svctx[5]; AL_reg(context)=svctx[6]; AL_reg(context)=svctx[7]; } else { /* save all registers */ svctx[0]=AL_reg(context); svctx[1]=AH_reg(context); svctx[2]=SS_reg(context); svctx[3]=SI_reg(context); svctx[4]=DL_reg(context); svctx[5]=DH_reg(context); svctx[6]=CL_reg(context); svctx[7]=CH_reg(context); } #endif /* __386__ */
Bob Goodwin wrote:> > I have an application that requires the interupt 31 save/restore > function. At this time, that's just a stub in wine. I propose the > following code as a template for a save/restore function. I'm not sure > about the whole thing and would like some help please. > Thanks. > > Best regards, > Bob Goodwin >Perhaps someone can help me with just this part; It appears that there is no limit on calls to interupt_31-AX=0305 (request the address of the save/restore handler.) That implies more than one thread could have a save/restore pointer. When calling the save/restore function, the only parameter passed is a byte in AL to indicate whether to save the current context or restore a saved context. My question is, are there multiple copies of the save/restore function or at least multiple entry points? It seems that this would be the only way of having multiple unique context saves. If only one context can be stored at a time, obviously a spin-lock will need to be provided to keep other applications holding until their turn. Thanks. Bob Goodwin