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

📄 fpu.c

📁 汇编源码大全 有各种汇编源码 希望对你有所帮助
💻 C
字号:
/*****************************************************************************
 * FILE: fpu.c								     *
 *									     *
 * DESC:								     *
 *	- FPU saving, FPU-EMU install					     *
 *									     *
 * Copyright (C) 1993,1994						     *
 *	Rainer Schnitker, Heeper Str. 283, 33607 Bielefeld		     *
 *	email: rainer@mathematik.uni-bielefeld.de			     *
 *									     *
 *****************************************************************************/

#include "DPMI.H"
#include "DPMI10.H"
#include "PROCESS.H"
#include "START32.H"
#include "FPU.H"

extern int used_math;
extern int debugged;
extern union i387_union *process_npx;

DWORD emu_init(void)
{
    int _ret;
    __asm__(
	"pushl  %%ebx \n\t"
	"pushl  %%edi \n\t"
	"pushl  %%esi \n\t"
	"pushl  _data16sel \n\t"
	"popl   %%gs \n\t"
	"pushl  %%cs \n\t"
	"call   _fpu_entry \n\t"
	"popl   %%esi \n\t"
	"popl   %%edi \n\t"
	"popl   %%ebx \n\t"
	: "=a"(_ret)
	: "d"(stackp16), "0"(0x12345678)
	: "ax", "dx"
    );
    return _ret;
}

void emu_switch(int x, int y)
{
    used_math = x;
    debugged = y;
    process_npx = &(npz->npx);
}

void do_fnsave(union i387_union * fpu_struct)
{
    __asm__(
	"fnsave %0"
	:"=m"( *fpu_struct)
    );
}

void do_frstor(union i387_union * fpu_struct)
{
    __asm__(
	"frstor %0"
	::"m"( *fpu_struct)
    );
}

void do_fninit(void)
{
    __asm__("fninit");
}

extern char * getenv(char *);

int npx_installed(void)
{
    char *s = getenv("RSX_x87");
    if (!s)
	return 0;
    else
	return (int) (*s - '0');
}

⌨️ 快捷键说明

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