Remove unnecessary variable in map_mem

the variable 'table_present' is redundant
in function(map_mem_region)

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
This commit is contained in:
Mingqiang Chi 2018-03-15 16:43:05 +08:00 committed by Jack Ren
parent 119b038551
commit f4780c0cd4
1 changed files with 4 additions and 17 deletions

View File

@ -166,7 +166,6 @@ static uint32_t map_mem_region(void *vaddr, void *paddr,
int ept_entry, enum mem_map_request_type request_type)
{
uint64_t table_entry;
uint64_t table_present;
uint32_t table_offset;
uint32_t mapped_size;
@ -237,21 +236,6 @@ static uint32_t map_mem_region(void *vaddr, void *paddr,
/* Check to see if mapping should occur */
if (mapped_size != 0) {
/* Get current table entry */
uint64_t tmp = MEM_READ64(table_base + table_offset);
/* Check if EPT entry */
if (ept_entry) {
/* Use read/write/execute bits to determine presence of
* entry
*/
table_present = (IA32E_EPT_R_BIT |
IA32E_EPT_W_BIT | IA32E_EPT_X_BIT);
} else {
/* Use the P bit to determine if an entry is present */
table_present = IA32E_COMM_P_BIT;
}
switch (request_type) {
case PAGING_REQUEST_TYPE_MAP:
{
@ -271,7 +255,10 @@ static uint32_t map_mem_region(void *vaddr, void *paddr,
}
case PAGING_REQUEST_TYPE_UNMAP:
{
if (tmp & table_present) {
/* Get current table entry */
uint64_t entry = MEM_READ64(table_base + table_offset);
if (entry) {
/* Table is present.
* Write the table entry to map this memory
*/