From aca996ebbeaa0accdbc4cfece48beccad5466b15 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 19 Apr 2026 19:09:25 -0400 Subject: [PATCH] sp1/amd64: tlb: Add TLB flush helper Signed-off-by: Ian Moffett --- usr/src/sp1/head/amd64/tlb.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 usr/src/sp1/head/amd64/tlb.h diff --git a/usr/src/sp1/head/amd64/tlb.h b/usr/src/sp1/head/amd64/tlb.h new file mode 100644 index 0000000..0af8915 --- /dev/null +++ b/usr/src/sp1/head/amd64/tlb.h @@ -0,0 +1,32 @@ +/* + * 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_TLB_H_ +#define _MACHINE_TLB_H_ 1 + +#include + +/* + * Flush a single entry from the translation lookaside buffer + * to force it to be translated again. + */ +__always_inline static void +md_tlb_flush(uintptr_t va) +{ + __asmv( + "invlpg (%0)" + : + : "r" (va) + : "memory" + ); +} + +#endif /* !_MACHINE_TLB_H_ */