Method, apparatus, and computer-readable medium for providing physical memory management functions
First Claim
1. A computer-implemented method for providing physical memory management functions to programs executing in a pre-boot environment, the method comprising:
- receiving an allocation request from a program executing in the pre-boot environment for allocating a portion of a physical computer memory, wherein the allocation request identifies a requested memory size, wherein the memory management functions are configured to maintain a single list of data structures describing the physical computer memory, the list of data structures comprising a first data structure describing a first area of the physical computer memory that is available for allocation, the first area comprising a first memory portion and a second memory portion contiguous to the first memory portion, the first data structure comprising a first pointer node, a first size node, and a first next node, the first pointer node referencing a beginning of the first memory portion of the physical computer memory, the first size node describing a combined memory size of the first memory portion and the second memory portion, the first next node referencing a null value, and wherein each and every data structure in the list of data structures describes an unallocated portion of the physical computer memory;
in response to receiving the allocation request, determining whether the requested memory size is available for allocation;
in response to determining that the requested memory size is available for allocation through the first memory portion, (i) allocating the first memory portion, (ii) updating the first pointer node from referencing the beginning of the first memory portion to referencing a beginning of the second memory portion, (iii) updating the first size node from describing the combined memory size of the first memory portion and the second memory portion to describing a memory size of the second memory portion, and (iv) returning a pointer to the first memory portion in response to the allocation request;
receiving a request to deallocate a second area of the physical computer memory that has been allocated, the request comprising a pointer to the second area of the physical computer memory to be deallocated; and
in response to receiving the deallocation request, determining the size of the second area, determining whether the second area was allocated by the memory management functions, and in response to determining that the second area was allocated by the memory management functions, (i) deallocating the second area, (ii) creating a second data structure describing the second area, and (iii) updating the first next node from referencing the null value to referencing the second data structure, the second data structure comprising a second pointer node, a second size node, and a second next node, the second pointer node referencing a beginning of the second area, the second size node describing a memory size of the second area, and the second next node referencing the null value.
3 Assignments
0 Petitions
Accused Products
Abstract
A method, apparatus, and computer-readable medium for providing memory management functions are provided. According to one method, a memory allocation process is exposed that receives a requested memory size with a memory allocation request and returns a pointer to an area of allocated memory of the requested memory size if available. A memory deallocation process is also exposed that receives requests to deallocate previously allocated memory regions in the form of a pointer to the memory region to be deallocated. The allocation and deallocation processes maintain a list of linked lists, each of the linked lists describing an unallocated portion of the memory. Only a single linked list must be updated by the allocation process. The deallocation process adds a new linked list and rebuilds the list of linked lists to merge any linked lists corresponding to adjacent portions of memory.
58 Citations
11 Claims
-
1. A computer-implemented method for providing physical memory management functions to programs executing in a pre-boot environment, the method comprising:
-
receiving an allocation request from a program executing in the pre-boot environment for allocating a portion of a physical computer memory, wherein the allocation request identifies a requested memory size, wherein the memory management functions are configured to maintain a single list of data structures describing the physical computer memory, the list of data structures comprising a first data structure describing a first area of the physical computer memory that is available for allocation, the first area comprising a first memory portion and a second memory portion contiguous to the first memory portion, the first data structure comprising a first pointer node, a first size node, and a first next node, the first pointer node referencing a beginning of the first memory portion of the physical computer memory, the first size node describing a combined memory size of the first memory portion and the second memory portion, the first next node referencing a null value, and wherein each and every data structure in the list of data structures describes an unallocated portion of the physical computer memory; in response to receiving the allocation request, determining whether the requested memory size is available for allocation; in response to determining that the requested memory size is available for allocation through the first memory portion, (i) allocating the first memory portion, (ii) updating the first pointer node from referencing the beginning of the first memory portion to referencing a beginning of the second memory portion, (iii) updating the first size node from describing the combined memory size of the first memory portion and the second memory portion to describing a memory size of the second memory portion, and (iv) returning a pointer to the first memory portion in response to the allocation request; receiving a request to deallocate a second area of the physical computer memory that has been allocated, the request comprising a pointer to the second area of the physical computer memory to be deallocated; and in response to receiving the deallocation request, determining the size of the second area, determining whether the second area was allocated by the memory management functions, and in response to determining that the second area was allocated by the memory management functions, (i) deallocating the second area, (ii) creating a second data structure describing the second area, and (iii) updating the first next node from referencing the null value to referencing the second data structure, the second data structure comprising a second pointer node, a second size node, and a second next node, the second pointer node referencing a beginning of the second area, the second size node describing a memory size of the second area, and the second next node referencing the null value. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A computer storage medium having computer-readable instructions stored thereon which, when executed by a computer in a pre-boot environment, cause the computer to:
-
receive an allocation request from a program executing in the pre-boot environment for allocating a portion of a physical computer memory, wherein the allocation request identifies a requested memory size, wherein the memory management functions are configured to maintain a single list of data structures describing the physical computer memory, the list of data structures comprising a first data structure describing a first area of the physical computer memory that is available for allocation, the first area comprising a first memory portion and a second memory portion contiguous to the first memory portion, the first data structure comprising a first pointer node, a first size node, and a first next node, the first pointer node referencing a beginning of the first memory portion of the physical computer memory, the first size node describing a combined memory size of the first memory portion and the second memory portion, the first next node referencing a null value, and wherein each and every data structure in the list of data structures describes an unallocated portion of the physical computer memory; in response to receiving the allocation request, determining whether the requested memory size is available for allocation; in response to determining that the requested memory size is available for allocation through the first memory portion, (i) allocating the first memory portion, (ii) updating the first pointer node from referencing the beginning of the first memory portion to referencing a beginning of the second memory portion, (iii) updating the first size node from describing the combined memory size of the first memory portion and the second memory portion to describing a memory size of the second memory portion, and (iv) returning a pointer to first memory portion in response to the allocation request; receive a request to deallocate a second area of the physical computer memory that has been allocated, the request comprising a pointer to the second area of the physical computer memory to be deallocated; and in response to receiving the deallocation request, determine the size of the second area, determining whether second area was allocated by the memory management functions, and in response to determining that the second area was allocated by the memory management functions, (i) deallocate the second area, (ii) create a second data structure describing the second area, and (iii) update the first next node from referencing the null value to referencing the second data structure, the second data structure comprising a second pointer node, a second size node, and a second next node, the second pointer node referencing a beginning of the second area, the second size node describing a memory size of the second area, and the second next node referencing the null value. - View Dependent Claims (9)
-
-
10. An apparatus capable of managing the allocation of memory in a pre-boot environment of a computer, comprising:
-
a processor; a memory area operatively connected to the processor; a firmware operatively connected to the processor; and one or more Basic Input/Output System (“
BIOS”
) routines contained in the firmware and configured toreceive an allocation request from a program executing in the pre-boot environment for allocating a portion of a physical computer memory, wherein the allocation request identifies a requested memory size, wherein the memory management functions are configured to maintain a single list of data structures describing the physical computer memory, the list of data structures comprising a first data structure describing a first area of the physical computer memory that is available for allocation, the first area comprising a first memory portion and a second memory portion contiguous to the first memory portion, the first data structure comprising a first pointer node, a first size node, and a first next node, the first pointer node referencing a beginning of the first memory portion of the physical computer memory, the first size node describing a combined memory size of the first memory portion and the second memory portion, the first next node referencing a null value, and wherein each and every data structure in the list of data structures describes an unallocated portion of the physical computer memory; in response to receiving the allocation request, determining whether the requested memory size is available for allocation; in response to determining that the requested memory size is available for allocation through the first memory portion, (i) allocating the first memory portion, (ii) updating the first pointer node from referencing the beginning of the first memory portion to referencing a beginning of the second memory portion, (iii) updating the first size node from describing the combined memory size of the first memory portion and the second memory portion to describing a memory size of the second memory portion, and (iv) returning a pointer to first memory portion in response to the allocation request; receive a request to deallocate a second area of the physical computer memory that has been allocated, the request comprising a pointer to the second area of the physical computer memory to be deallocated; and in response to receiving the deallocation request, determine the size of the second area, determining whether second area was allocated by the memory management functions, and in response to determining that the second area was allocated by the memory management functions, (i) deallocate the second area, (ii) create a second data structure describing the second area, and (iii) update the first next node from referencing the null value to referencing the second data structure, the second data structure comprising a second pointer node, a second size node, and a second next node, the second pointer node referencing a beginning of the second area, the second size node describing a memory size of the second area, and the second next node referencing the null value. - View Dependent Claims (11)
-
Specification