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

This commit is contained in:
Michael Lotz
2014-08-31 12:08:20 +02:00
parent 9c0623a8f2
commit 2747989d9e
@@ -9,6 +9,7 @@
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <KernelExport.h> #include <KernelExport.h>
#include <SupportDefs.h>
#include <util/kernel_cpp.h> #include <util/kernel_cpp.h>
#include "BeOSCompatibility.h" #include "BeOSCompatibility.h"
#include "PhysicalMemoryAllocator.h" #include "PhysicalMemoryAllocator.h"
@@ -133,6 +134,13 @@ PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress,
{ {
#ifdef HAIKU_TARGET_PLATFORM_HAIKU #ifdef HAIKU_TARGET_PLATFORM_HAIKU
if (debug_debugger_running()) { 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++) { for (int32 i = 0; i < 64; i++) {
uint64 mask = 1LL << i; uint64 mask = 1LL << i;
if ((fDebugUseMap & mask) == 0) { if ((fDebugUseMap & mask) == 0) {