fxsave/fxrstor stub

This commit is contained in:
Alex 2022-10-28 03:28:52 +03:00
parent f2b80cd3a9
commit 400a715e94
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
3 changed files with 29 additions and 4 deletions

View File

@ -137,7 +137,7 @@ namespace Tasking
{
// Save current process and thread registries, gs, fs, fpu, etc...
CurrentCPU->CurrentThread->Registers = *Frame;
// _fxsave(CurrentCPU->CurrentThread->FXRegion);
CPU::x64::fxsave(CurrentCPU->CurrentThread->FXRegion);
// Set the process & thread as ready if it's running.
if (CurrentCPU->CurrentProcess->Status == TaskStatus::Running)
@ -264,7 +264,7 @@ namespace Tasking
*Frame = CurrentCPU->CurrentThread->Registers;
CPU::x64::writecr3({.raw = (uint64_t)CurrentCPU->CurrentProcess->PageTable});
// _fxrstor(CurrentCPU->CurrentThread->FXRegion);
CPU::x64::fxrstor(CurrentCPU->CurrentThread->FXRegion);
goto End;
}
@ -295,7 +295,7 @@ namespace Tasking
error("Unknown trust level %d.", CurrentCPU->CurrentProcess->Security.TrustLevel);
break;
}
// _fxrstor(CurrentCPU->CurrentThread->FXRegion);
CPU::x64::fxrstor(CurrentCPU->CurrentThread->FXRegion);
}
End:
{

View File

@ -1557,6 +1557,26 @@ namespace CPU
#endif
}
static inline void fxsave(char *FXSaveArea)
{
#if defined(__amd64__)
// asmv("fxsaveq (%0)"
// :
// : "r"(FXSaveArea)
// : "memory");
#endif
}
static inline void fxrstor(char *FXRstorArea)
{
#if defined(__amd64__)
// asmv("fxrstorq (%0)"
// :
// : "r"(FXRstorArea)
// : "memory");
#endif
}
/** @brief EXPERIMENTAL IMPLEMENTATION */
namespace Intel
{
@ -3091,6 +3111,10 @@ namespace CPU
};
}
}
namespace aarch64
{
}
}
#endif // !__FENNIX_KERNEL_CPU_H__

View File

@ -91,6 +91,7 @@ namespace Tasking
#endif
TaskSecurity Security;
TaskInfo Info;
char FXRegion[512] __attribute__((aligned(16)));
void Rename(const char *name)
{
@ -119,8 +120,8 @@ namespace Tasking
TaskInfo Info;
Vector<TCB *> Threads;
Vector<PCB *> Children;
Memory::PageTable *PageTable;
HashMap<InterProcessCommunication::IPCPort, uint64_t> *IPCHandles;
Memory::PageTable *PageTable;
};
enum TokenTrustLevel