TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmMemLib.h File Reference

Go to the source code of this file.

Functions

BOOLEAN EFIAPI SmmIsBufferOutsideSmmValid (IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
 
EFI_STATUS EFIAPI SmmCopyMemToSmram (OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
 
EFI_STATUS EFIAPI SmmCopyMemFromSmram (OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
 
EFI_STATUS EFIAPI SmmCopyMem (OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
 
EFI_STATUS EFIAPI SmmSetMem (OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
 

Detailed Description

Provides services for SMM Memory Operation.

The SMM Mem Library provides function for checking if buffer is outside SMRAM and valid. It also provides functions for copy data from SMRAM to non-SMRAM, from non-SMRAM to SMRAM, from non-SMRAM to non-SMRAM, or set data in non-SMRAM.

Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SmmMemLib.h.

Function Documentation

◆ SmmCopyMem()

EFI_STATUS EFIAPI SmmCopyMem ( OUT VOID *  DestinationBuffer,
IN CONST VOID *  SourceBuffer,
IN UINTN  Length 
)

Copies a source buffer (NON-SMRAM) to a destination buffer (NON-SMRAM).

This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). It checks if source buffer and destination buffer are valid per processor architecture and not overlap with SMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. The implementation must be reentrant, and it must handle the case where source buffer overlaps destination buffer.

Parameters
DestinationBufferThe pointer to the destination buffer of the memory copy.
SourceBufferThe pointer to the source buffer of the memory copy.
LengthThe number of bytes to copy from SourceBuffer to DestinationBuffer.
Return values
EFI_SECURITY_VIOLATIONThe DestinationBuffer is invalid per processor architecture or overlap with SMRAM.
EFI_SECURITY_VIOLATIONThe SourceBuffer is invalid per processor architecture or overlap with SMRAM.
EFI_SUCCESSMemory is copied.

Definition at line 328 of file SmmMemLib.c.

◆ SmmCopyMemFromSmram()

EFI_STATUS EFIAPI SmmCopyMemFromSmram ( OUT VOID *  DestinationBuffer,
IN CONST VOID *  SourceBuffer,
IN UINTN  Length 
)

Copies a source buffer (SMRAM) to a destination buffer (NON-SMRAM).

This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). It checks if destination buffer is valid per processor architecture and not overlap with SMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. The implementation must be reentrant.

Parameters
DestinationBufferThe pointer to the destination buffer of the memory copy.
SourceBufferThe pointer to the source buffer of the memory copy.
LengthThe number of bytes to copy from SourceBuffer to DestinationBuffer.
Return values
EFI_SECURITY_VIOLATIONThe DestinationBuffer is invalid per processor architecture or overlap with SMRAM.
EFI_SUCCESSMemory is copied.

Definition at line 293 of file SmmMemLib.c.

◆ SmmCopyMemToSmram()

EFI_STATUS EFIAPI SmmCopyMemToSmram ( OUT VOID *  DestinationBuffer,
IN CONST VOID *  SourceBuffer,
IN UINTN  Length 
)

Copies a source buffer (non-SMRAM) to a destination buffer (SMRAM).

This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). It checks if source buffer is valid per processor architecture and not overlap with SMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it return EFI_SECURITY_VIOLATION. The implementation must be reentrant.

Parameters
DestinationBufferThe pointer to the destination buffer of the memory copy.
SourceBufferThe pointer to the source buffer of the memory copy.
LengthThe number of bytes to copy from SourceBuffer to DestinationBuffer.
Return values
EFI_SECURITY_VIOLATIONThe SourceBuffer is invalid per processor architecture or overlap with SMRAM.
EFI_SUCCESSMemory is copied.

Definition at line 259 of file SmmMemLib.c.

◆ SmmIsBufferOutsideSmmValid()

BOOLEAN EFIAPI SmmIsBufferOutsideSmmValid ( IN EFI_PHYSICAL_ADDRESS  Buffer,
IN UINT64  Length 
)

This function check if the buffer is valid per processor architecture and not overlap with SMRAM.

Parameters
BufferThe buffer start address to be checked.
LengthThe buffer length to be checked.
Return values
TRUEThis buffer is valid per processor architecture and not overlap with SMRAM.
FALSEThis buffer is not valid per processor architecture or overlap with SMRAM.

Definition at line 114 of file SmmMemLib.c.

◆ SmmSetMem()

EFI_STATUS EFIAPI SmmSetMem ( OUT VOID *  Buffer,
IN UINTN  Length,
IN UINT8  Value 
)

Fills a target buffer (NON-SMRAM) with a byte value.

This function fills a target buffer (non-SMRAM) with a byte value. It checks if target buffer is valid per processor architecture and not overlap with SMRAM. If the check passes, it fills memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION.

Parameters
BufferThe memory to set.
LengthThe number of bytes to set.
ValueThe value with which to fill Length bytes of Buffer.
Return values
EFI_SECURITY_VIOLATIONThe Buffer is invalid per processor architecture or overlap with SMRAM.
EFI_SUCCESSMemory is set.

Definition at line 366 of file SmmMemLib.c.