USB: Warn if debug allocation does not fit debug chunk size.

This commit is contained in:
Michael Lotz 2014-08-31 10:56:32 +02:00
parent 9c0623a8f2
commit 2747989d9e

View File

@ -9,6 +9,7 @@
#include <malloc.h>
#include <string.h>
#include <KernelExport.h>
#include <SupportDefs.h>
#include <util/kernel_cpp.h>
#include "BeOSCompatibility.h"
#include "PhysicalMemoryAllocator.h"
@ -133,6 +134,13 @@ PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress,
{
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
if (debug_debugger_running()) {
if (size > fDebugChunkSize) {
kprintf("usb allocation of %" B_PRIuSIZE
" does not fit debug chunk size %" B_PRIuSIZE "!\n",
size, fDebugChunkSize);
return B_NO_MEMORY;
}
for (int32 i = 0; i < 64; i++) {
uint64 mask = 1LL << i;
if ((fDebugUseMap & mask) == 0) {