Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
accel/tcg: Introduce page_check_range_empty
Examine the interval tree to validate that a region
has no existing mappings.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230707204054.8792-10-richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Jul 15, 2023
1 parent 4b840f9 commit c2281dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions accel/tcg/user-exec.c
Expand Up @@ -598,6 +598,13 @@ int page_check_range(target_ulong start, target_ulong len, int flags)
return ret;
}

bool page_check_range_empty(target_ulong start, target_ulong last)
{
assert(last >= start);
assert_memory_lock();
return pageflags_find(start, last) == NULL;
}

void page_protect(tb_page_addr_t address)
{
PageFlagsNode *p;
Expand Down
12 changes: 12 additions & 0 deletions include/exec/cpu-all.h
Expand Up @@ -224,6 +224,18 @@ void page_set_flags(target_ulong start, target_ulong last, int flags);
void page_reset_target_data(target_ulong start, target_ulong last);
int page_check_range(target_ulong start, target_ulong len, int flags);

/**
* page_check_range_empty:
* @start: first byte of range
* @last: last byte of range
* Context: holding mmap lock
*
* Return true if the entire range [@start, @last] is unmapped.
* The memory lock must be held so that the caller will can ensure
* the result stays true until a new mapping can be installed.
*/
bool page_check_range_empty(target_ulong start, target_ulong last);

/**
* page_get_target_data(address)
* @address: guest virtual address
Expand Down

0 comments on commit c2281dd

Please sign in to comment.