@@ -2327,6 +2327,14 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
{
target_ulong addr, len;
+ /* This function should never be called with addresses outside the
+ guest address space. If this assert fires, it probably indicates
+ a missing call to h2g_valid. */
+#if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS
+ assert(end < (1ul << TARGET_VIRT_ADDR_SPACE_BITS));
+#endif
+ assert(start < end);
+
start = start & TARGET_PAGE_MASK;
end = TARGET_PAGE_ALIGN(end);
@@ -2356,6 +2364,13 @@ int page_check_range(target_ulong start, target_ulong len, int flags)
target_ulong end;
target_ulong addr;
+ /* This function should never be called with addresses outside the
+ guest address space. If this assert fires, it probably indicates
+ a missing call to h2g_valid. */
+#if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS
+ assert(start < (1ul << TARGET_VIRT_ADDR_SPACE_BITS));
+#endif
+
if (start + len - 1 < start) {
/* We've wrapped around. */
return -1;