void
swap_x86_debug_state(
    x86_debug_state_t *debug,
    enum NXByteOrder target_byte_sex)
{
    x86_state_hdr_t hdr;
    enum NXByteOrder host_byte_sex;

    host_byte_sex = NXHostByteOrder();
    hdr = debug->dsh;
    if(target_byte_sex == host_byte_sex)
        swap_x86_state_hdr(&hdr, host_byte_sex);

    swap_x86_state_hdr(&debug->dsh, target_byte_sex);

    if(hdr.flavor == x86_DEBUG_STATE32)
        swap_x86_debug_state32(&debug->uds.ds32, target_byte_sex);
    else if(hdr.flavor == x86_DEBUG_STATE64)
        swap_x86_debug_state64(&debug->uds.ds64, target_byte_sex);
}
void
swap_x86_exception_state(
    x86_exception_state_t *exc,
    enum NXByteOrder target_byte_sex)
{
    x86_state_hdr_t hdr;
    enum NXByteOrder host_byte_sex;

    host_byte_sex = NXHostByteOrder();
    hdr = exc->esh;
    if(target_byte_sex == host_byte_sex)
        swap_x86_state_hdr(&hdr, host_byte_sex);

    swap_x86_state_hdr(&exc->esh, target_byte_sex);

    if(hdr.flavor == x86_EXCEPTION_STATE32)
        swap_i386_exception_state(&exc->ues.es32, target_byte_sex);
    else if(hdr.flavor == x86_EXCEPTION_STATE64)
        swap_x86_exception_state64(&exc->ues.es64, target_byte_sex);
}
void
swap_x86_float_state(
    x86_float_state_t *fpu,
    enum NXByteOrder target_byte_sex)
{
    x86_state_hdr_t hdr;
    enum NXByteOrder host_byte_sex;

    host_byte_sex = NXHostByteOrder();
    hdr = fpu->fsh;
    if(target_byte_sex == host_byte_sex)
        swap_x86_state_hdr(&hdr, host_byte_sex);

    swap_x86_state_hdr(&fpu->fsh, target_byte_sex);

    if(hdr.flavor == x86_FLOAT_STATE32)
        swap_i386_float_state(&fpu->ufs.fs32, target_byte_sex);
    else if(hdr.flavor == x86_FLOAT_STATE64)
        swap_x86_float_state64(&fpu->ufs.fs64, target_byte_sex);
}
void
swap_x86_thread_state(
    x86_thread_state_t *cpu,
    enum NXByteOrder target_byte_sex)
{
    x86_state_hdr_t hdr;
    enum NXByteOrder host_byte_sex;

    host_byte_sex = NXHostByteOrder();
    hdr = cpu->tsh;
    if(target_byte_sex == host_byte_sex)
        swap_x86_state_hdr(&hdr, host_byte_sex);

    swap_x86_state_hdr(&cpu->tsh, target_byte_sex);

    if(hdr.flavor == x86_THREAD_STATE32)
        swap_i386_thread_state(&cpu->uts.ts32, target_byte_sex);
    else if(hdr.flavor == x86_THREAD_STATE64)
        swap_x86_thread_state64(&cpu->uts.ts64, target_byte_sex);
}
Esempio n. 5
0
void
swap_x86_exception_state(
x86_exception_state_t *exc,
enum NXByteOrder target_byte_sex)
{
    x86_state_hdr_t hdr;
    enum NXByteOrder host_byte_sex;

	host_byte_sex = NXHostByteOrder();
	hdr = exc->esh;
	if(target_byte_sex == host_byte_sex)
	    swap_x86_state_hdr(&hdr, host_byte_sex);

	swap_x86_state_hdr(&exc->esh, target_byte_sex);

/* current i386 thread states */
#if i386_THREAD_STATE == 1
	if(hdr.flavor == x86_EXCEPTION_STATE32)
	    swap_i386_exception_state(&exc->ues.es32, target_byte_sex);
	else
#endif
	if(hdr.flavor == x86_EXCEPTION_STATE64)
	    swap_x86_exception_state64(&exc->ues.es64, target_byte_sex);
}
Esempio n. 6
0
void
swap_x86_float_state(
x86_float_state_t *fpu,
enum NXByteOrder target_byte_sex)
{
    x86_state_hdr_t hdr;
    enum NXByteOrder host_byte_sex;

	host_byte_sex = NXHostByteOrder();
	hdr = fpu->fsh;
	if(target_byte_sex == host_byte_sex)
	    swap_x86_state_hdr(&hdr, host_byte_sex);

	swap_x86_state_hdr(&fpu->fsh, target_byte_sex);

/* current i386 thread states */
#if i386_THREAD_STATE == 1
	if(hdr.flavor == x86_FLOAT_STATE32)
	    swap_i386_float_state(&fpu->ufs.fs32, target_byte_sex);
	else
#endif
	if(hdr.flavor == x86_FLOAT_STATE64)
	    swap_x86_float_state64(&fpu->ufs.fs64, target_byte_sex);
}