ptos/amd64+hal: Add processor primitives

Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
2026-07-10 21:07:24 -04:00
parent eb009076b2
commit abad8f8cfe
2 changed files with 90 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: Processor primitives
* Author: Chloe M.
*/
#ifndef _HAL_PRIM_H_
#define _HAL_PRIM_H_ 1
#include <machine/prim.h>
#include <ptdef.h>
/*
* Suspend the current processor until the next
* interrupt.
*/
ALWAYS_INLINE static inline VOID
HalCpuSuspend(VOID)
{
MdCpuSuspend();
}
/*
* Hint to the processor core that it is in a spin
* loop.
*/
ALWAYS_INLINE static inline VOID
HalCpuSpinWait(VOID)
{
MdCpuSpinWait();
}
/*
* Perform an atomic swap operation
*
* @Ptr: Location to swap with @Value
* @Value: Value to swap with data at @Ptr
*/
ALWAYS_INLINE static inline VOID
HalCpuAswap(UQUAD *Ptr, UQUAD Value)
{
MdCpuAswap(Ptr, Value);
}
#endif /* !_HAL_PRIM_H_ */