kernel: Add assertions to ensure vm_page_reservation is destroyed with a count of 0.
Inspired by some of jpelczar's changes.
This commit is contained in:
@@ -20,6 +20,14 @@ extern int32 gMappedPagesCount;
|
||||
|
||||
struct vm_page_reservation {
|
||||
uint32 count;
|
||||
|
||||
#if KDEBUG && defined(__cplusplus)
|
||||
vm_page_reservation() : count(0) {}
|
||||
~vm_page_reservation()
|
||||
{
|
||||
ASSERT(count == 0);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -3990,8 +3990,10 @@ vm_page_allocate_page_run(uint32 flags, page_num_t length,
|
||||
|
||||
if (foundRun) {
|
||||
i = allocate_page_run(start, length, flags, freeClearQueueLocker);
|
||||
if (i == length)
|
||||
if (i == length) {
|
||||
reservation.count = 0;
|
||||
return &sPages[start];
|
||||
}
|
||||
|
||||
// apparently a cached page couldn't be allocated -- skip it and
|
||||
// continue
|
||||
|
||||
Reference in New Issue
Block a user