1# x86 System Management Mode 2 3## Introduction 4 5The code running in System Management Mode (SMM) provides runtime services 6to applications running in [ring0]. It has a higher privilege level than 7[ring0] and resides in the SMRAM region which cannot be accessed from [ring0]. 8 9SMM can be entered by issuing System Management Interrupts (SMIs). 10 11## Secure data exchange 12 13In order to not leak SMM internals or accidentally overwrite parts of SMM, 14[ring0] provided data (pointers, offsets, sizes, ...) must be checked before 15using them in SMM. 16 17There exist two methods to verify data: 18 19```C 20/* Returns true if the region overlaps with the SMM */ 21bool smm_region_overlaps_handler(struct region *r); 22``` 23 24```C 25/* Returns true if the memory pointed to overlaps with SMM reserved memory. */ 26static inline bool smm_points_to_smram(const void *ptr, const size_t len); 27``` 28 29[ring0]: https://en.wikipedia.org/wiki/Protection_ring 30