#include <ndk/asm.h>
-#define CONTEXT_FULL 0x10007
-#define CONTEXT_FLOATING_POINT 0xF
-
.globl _SwitchToFiber@4
.intel_syntax noprefix
_SwitchToFiber@4:
/* Get the TEB */
- mov edx, fs:[KGDT_R3_TEB]
+ mov edx, fs:[TEB_SELF]
/* Get the Fiber */
mov eax, [edx+TEB_FIBER_DATA]
mov [eax+FIBER_CONTEXT_EBP], ebp
/* Check if we're to save FPU State */
- cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL + CONTEXT_FLOATING_POINT
+ cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL | CONTEXT_FLOATING_POINT
jnz NoFpuStateSave
/* Save the FPU State (Status and Control)*/
mov [edx+TEB_ACTIVATION_CONTEXT_STACK_POINTER], esi
/* Restore FPU State */
- cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL + CONTEXT_FLOATING_POINT
+ cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL | CONTEXT_FLOATING_POINT
jnz NoFpuStateRestore
/* Check if the Status Word Changed */