Commit f64d86eb authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Support converting server contexts from one machine to another.

parent 542175ab
......@@ -754,78 +754,6 @@ static inline void restore_fpu( const CONTEXT *context )
/***********************************************************************
* fpux_to_fpu
*
* Build a standard FPU context from an extended one.
*/
static void fpux_to_fpu( FLOATING_SAVE_AREA *fpu, const XSAVE_FORMAT *fpux )
{
unsigned int i, tag, stack_top;
fpu->ControlWord = fpux->ControlWord | 0xffff0000;
fpu->StatusWord = fpux->StatusWord | 0xffff0000;
fpu->ErrorOffset = fpux->ErrorOffset;
fpu->ErrorSelector = fpux->ErrorSelector | (fpux->ErrorOpcode << 16);
fpu->DataOffset = fpux->DataOffset;
fpu->DataSelector = fpux->DataSelector;
fpu->Cr0NpxState = fpux->StatusWord | 0xffff0000;
stack_top = (fpux->StatusWord >> 11) & 7;
fpu->TagWord = 0xffff0000;
for (i = 0; i < 8; i++)
{
memcpy( &fpu->RegisterArea[10 * i], &fpux->FloatRegisters[i], 10 );
if (!(fpux->TagWord & (1 << i))) tag = 3; /* empty */
else
{
const M128A *reg = &fpux->FloatRegisters[(i - stack_top) & 7];
if ((reg->High & 0x7fff) == 0x7fff) /* exponent all ones */
{
tag = 2; /* special */
}
else if (!(reg->High & 0x7fff)) /* exponent all zeroes */
{
if (reg->Low) tag = 2; /* special */
else tag = 1; /* zero */
}
else
{
if (reg->Low >> 63) tag = 0; /* valid */
else tag = 2; /* special */
}
}
fpu->TagWord |= tag << (2 * i);
}
}
/***********************************************************************
* fpu_to_fpux
*
* Fill extended FPU context from standard one.
*/
static void fpu_to_fpux( XSAVE_FORMAT *fpux, const FLOATING_SAVE_AREA *fpu )
{
unsigned int i;
fpux->ControlWord = fpu->ControlWord;
fpux->StatusWord = fpu->StatusWord;
fpux->ErrorOffset = fpu->ErrorOffset;
fpux->ErrorSelector = fpu->ErrorSelector;
fpux->ErrorOpcode = fpu->ErrorSelector >> 16;
fpux->DataOffset = fpu->DataOffset;
fpux->DataSelector = fpu->DataSelector;
fpux->TagWord = 0;
for (i = 0; i < 8; i++)
{
if (((fpu->TagWord >> (i * 2)) & 3) != 3)
fpux->TagWord |= 1 << i;
memcpy( &fpux->FloatRegisters[i], &fpu->RegisterArea[10 * i], 10 );
}
}
/***********************************************************************
* save_context
*
* Build a context structure from the signal info.
......
......@@ -179,6 +179,8 @@ extern void server_init_process_done(void) DECLSPEC_HIDDEN;
extern void server_init_thread( void *entry_point, BOOL *suspend ) DECLSPEC_HIDDEN;
extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
extern void fpux_to_fpu( I386_FLOATING_SAVE_AREA *fpu, const XSAVE_FORMAT *fpux ) DECLSPEC_HIDDEN;
extern void fpu_to_fpux( XSAVE_FORMAT *fpux, const I386_FLOATING_SAVE_AREA *fpu ) DECLSPEC_HIDDEN;
extern void set_thread_id( TEB *teb, DWORD pid, DWORD tid ) DECLSPEC_HIDDEN;
extern NTSTATUS init_thread_stack( TEB *teb, ULONG_PTR zero_bits, SIZE_T reserve_size, SIZE_T commit_size ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN abort_thread( int status ) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment