if( !MM_GetPhysAddr(ent) )
Log_KernelPanic("MBoot", "MBoot Map entry %i addres bad (%p)",
nPMemMapEnts, ent);
+ LOG("%llx+%llx", ent->Base, ent->Length);
nent->Start = ent->Base;
nent->Length = ent->Length;
}
// Ensure it's valid
+ LOG("Validating");
nPMemMapEnts = PMemMap_ValidateMap(Map, nPMemMapEnts, MapSize);
// TODO: Error handling
// Replace kernel with PMEMTYPE_USED
+ LOG("Marking kernel");
nPMemMapEnts = PMemMap_MarkRangeUsed(
Map, nPMemMapEnts, MapSize,
KStart, KEnd - KStart
);
+ LOG("Dumping");
PMemMap_DumpBlocks(Map, nPMemMapEnts);
// Check if boot modules were passed
# define LEAVE_RET(_t,_v...) return (_v)
# define LEAVE_RET0() return
#endif
-#if SANITY
+#if !DISABLE_ASSERTS
# define ASSERT(expr) do{if(!(expr))Panic("%s:%i - %s: Assertion '"#expr"' failed",__FILE__,__LINE__,(char*)__func__);}while(0)
#else
# define ASSERT(expr)
#define PUTCH(ch) do { \
if(pos < __maxlen) { \
if(__s) __s[pos] = ch; \
+ } else { \
+ (void)ch;\
} \
pos ++; \
} while(0)
va_list args_tmp;
if( Level >= NUM_LOG_LEVELS ) return;
-
+
va_copy(args_tmp, Args);
len = vsnprintf(NULL, 256, Format, args_tmp);
- //Log("len = %i", len);
-
#if USE_RING_BUFFER || !CACHE_MESSAGES
{
char buf[sizeof(tLogEntry)+len+1];
{
tUSBHost *host;
- host = malloc(sizeof(tUSBHost) + sizeof(tUSBDevice) + sizeof(tUSBInterface) + nPorts*sizeof(tUSBHubPort));
+ host = malloc(sizeof(tUSBHost) + nPorts*sizeof(tUSBHubPort) + sizeof(tUSBDevice) + sizeof(tUSBInterface));
if(!host) {
// Oh, bugger.
return NULL;
host->Ptr = ControllerPtr;
memset(host->AddressBitmap, 0, sizeof(host->AddressBitmap));
- host->RootHubDev = (void*)(host + 1);
+ host->RootHubDev = (void*)(host->RootHub.Ports + nPorts);
host->RootHubDev->ParentHub = NULL;
host->RootHubDev->Host = host;
host->RootHubDev->Address = 0;
ASSERT(HostDef->InitControl);
host->RootHubDev->EndpointHandles[0] = HostDef->InitControl(ControllerPtr, 0, 64);
+ host->RootHubDev->nInterfaces = 0;
host->RootHubIf = (void*)(host->RootHubDev + 1);
-// host->RootHubIf->Next = NULL;
host->RootHubIf->Dev = host->RootHubDev;
host->RootHubIf->Driver = NULL;
host->RootHubIf->Data = NULL;
int USB_int_AllocateAddress(tUSBHost *Host)
{
int i;
+ ASSERT(Host);
for( i = 1; i < 128; i ++ )
{
if(Host->AddressBitmap[i/8] & (1 << (i%8)))