kernel32.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 50 行

C
50
字号
/* extern (library) versions of inline functions defined in winnt.h */

#if defined(__GNUC__)

void* GetCurrentFiber(void)
{
    void* ret;
    __asm__ volatile (
	"movl	%%fs:0x10,%0"
	: "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
	);
    return ret;
}

void* GetFiberData(void)
{
    void* ret;
    __asm__ volatile (            
	"movl	%%fs:0x10,%0\n"
	"movl	(%0),%0"
	: "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
	);
    return ret;
}

#elif !defined (__WATCOMC__)

void* GetCurrentFiber(void)
{
    void* res;
    _asm {
    	mov	eax, dword ptr fs:0x10
    	mov	res, eax
    };
    return res;
}

void* GetFiberData(void)
{
    void* res;
    _asm {
	mov	eax, dword ptr fs:0x10
	mov	eax, [eax]
	mov	res, eax
    };
    return res;
}

#endif /* __GNUC__ */

⌨️ 快捷键说明

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