ptos/amd64+hal: Add processor primitives
Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
@@ -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_ */
|
||||
Reference in New Issue
Block a user