summaryrefslogtreecommitdiff
path: root/src/include/cpu/x86
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2020-05-06 10:55:12 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-06-17 09:17:56 +0000
commit41fec869fb3b25fd5bb5b454ab1bf39660ce314d (patch)
tree914ae7cef0e1b90e2173d62f3698a8e30a9a1655 /src/include/cpu/x86
parentc59d9e3917a4d30d74d64c8210ed3a516b269534 (diff)
cpu/x86/smm: Add helper functions to verify SMM access
* Add a function to check if a region overlaps with SMM. * Add a function to check if a pointer points to SMM. * Document functions in Documentation/security/smm To be used to verify data accesses in SMM. Change-Id: Ia525d2bc685377f50ecf3bdcf337a4c885488213 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Christian Walter <christian.walter@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41084 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include/cpu/x86')
-rw-r--r--src/include/cpu/x86/smm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h
index 75c19a5cd5..ca834743b5 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -4,6 +4,7 @@
#define CPU_X86_SMM_H
#include <arch/cpu.h>
+#include <commonlib/region.h>
#include <types.h>
#define SMM_DEFAULT_BASE 0x30000
@@ -93,6 +94,17 @@ asmlinkage void smm_handler_start(void *params);
* account CPUs which are configured to not save their state to RAM. */
void *smm_get_save_state(int cpu);
+/* Returns true if the region overlaps with the SMM */
+bool smm_region_overlaps_handler(const struct region *r);
+
+/* Returns true if the memory pointed to overlaps with SMM reserved memory. */
+static inline bool smm_points_to_smram(const void *ptr, const size_t len)
+{
+ const struct region r = {(uintptr_t)ptr, len};
+
+ return smm_region_overlaps_handler(&r);
+}
+
/* SMM Module Loading API */
/* The smm_loader_params structure provides direction to the SMM loader: