From e66c15b914f730bf528a25cfcef6d82d0f3dc88b Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 17 Apr 2026 08:51:12 -0400 Subject: [PATCH] sp1: mu: Add standard CPU macros Signed-off-by: Ian Moffett --- usr/src/sp1/head/amd64/cpudef.h | 29 +++++++++++++++++++++++++++++ usr/src/sp1/head/mu/cpu.h | 7 +++++++ 2 files changed, 36 insertions(+) create mode 100644 usr/src/sp1/head/amd64/cpudef.h diff --git a/usr/src/sp1/head/amd64/cpudef.h b/usr/src/sp1/head/amd64/cpudef.h new file mode 100644 index 0000000..b9aca80 --- /dev/null +++ b/usr/src/sp1/head/amd64/cpudef.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2026, Mirocom Laboratories + * All rights reserved. + * + * The following sources are CONFIDENTIAL and PROPRIETARY + * property of Mirocom Laboratories. Unauthorized copying, + * use, distribution or modification of this file, in whole + * and in part, is strictly prohibited without the prior written + * consent from Mirocom Laboratories. + */ + +#ifndef _MACHINE_CPUDEF_H_ +#define _MACHINE_CPUDEF_H_ 1 + +#include + +#define md_cpu_halt() \ + __asmv("hlt" ::: "memory") + +#define md_cpu_wait() \ + __asmv("pause" ::: "memory") + +#define md_cpu_intoff() \ + __asmv("cli" ::: "memory") + +#define md_cpu_inton() \ + __asmv("sti" ::: "memory") + +#endif /* !_MACHINE_CPUDEF_H_ */ diff --git a/usr/src/sp1/head/mu/cpu.h b/usr/src/sp1/head/mu/cpu.h index dc9a0f7..19b57ff 100644 --- a/usr/src/sp1/head/mu/cpu.h +++ b/usr/src/sp1/head/mu/cpu.h @@ -14,6 +14,13 @@ #include #include /* shared */ +#include /* shared */ + +/* cpudef.h glue */ +#define mu_cpu_halt md_cpu_halt /* Halt current core */ +#define mu_cpu_wait md_cpu_wait /* Spinwait hint */ +#define mu_cpu_intoff md_cpu_intoff /* Disable interrupts */ +#define mu_cpu_inton md_cpu_inton /* Enable interrupts */ /* * MI processor specific information