Skip to content

Commit

Permalink
USB: Warn if debug allocation does not fit debug chunk size.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmlr committed Aug 31, 2014
1 parent 9c0623a commit 2747989
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2747989

Please sign in to comment.