ptos/amd64: cpu: Add HalKpcrCurrent()
Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
*/
|
||||
|
||||
#include <hal/kpcr.h>
|
||||
#include <ke/bugcheck.h>
|
||||
#include <machine/idt.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/msr.h>
|
||||
|
||||
/*
|
||||
* Initialize interrupts for the current processor
|
||||
@@ -34,8 +36,28 @@ InitInterrupts(VOID)
|
||||
MdIdtLoad();
|
||||
}
|
||||
|
||||
KPCR *
|
||||
HalKpcrCurrent(VOID)
|
||||
{
|
||||
KPCR *Kpcr;
|
||||
|
||||
Kpcr = (KPCR *)MdRdmsr(IA32_GS_BASE);
|
||||
if (Kpcr == NULL) {
|
||||
KeBugCheck(
|
||||
BUGCHECK_UNBOUND_RESRC,
|
||||
"KPCR not bound in IA32_GS_BASE\n"
|
||||
);
|
||||
}
|
||||
|
||||
return Kpcr;
|
||||
}
|
||||
|
||||
VOID
|
||||
HalKpcrP1Init(KPCR *Kpcr)
|
||||
{
|
||||
/* Initialize interrupts for this core */
|
||||
InitInterrupts();
|
||||
|
||||
/* Save the current KPCR */
|
||||
MdWrmsr(IA32_GS_BASE, (UPTR)Kpcr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user