Welcome to mirror list, hosted at ThFree Co, Russian Federation.

kernel32.c « lib « w32api « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08ff86c25e880fc055aaf4f97e6090ffbfb37f10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* 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__ */