Skip to content

Commit f3e54f3

Browse files
committed
Host (Haiku): add debug log
1 parent 5f3ff07 commit f3e54f3

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/util/smbiosHelper.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,42 +223,46 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
223223
off_t tableAddress = 0;
224224
FF_AUTO_CLOSE_FD int fd = open("/dev/misc/mem", O_RDONLY);
225225
if (fd < 0)
226-
return NULL;
226+
{perror("open(mem)");return NULL;}
227227
FF_AUTO_FREE uint8_t* smBiosBase = malloc(0x10000);
228228
if (pread(fd, smBiosBase, 0x10000, 0xF0000) != 0x10000)
229-
return NULL;
230-
229+
{perror("pread(fd)");return NULL;}
230+
puts("read(mem) ok");
231231
for (off_t offset = 0; offset <= 0xffe0; offset += 0x10)
232232
{
233233
FFSmbiosEntryPoint* p = (void*)(smBiosBase + offset);
234234
if (memcmp(p, "_SM3_", sizeof(p->Smbios30.AnchorString)) == 0)
235235
{
236+
puts("found SM3");
236237
if (p->Smbios30.EntryPointLength != sizeof(p->Smbios30))
237-
return NULL;
238+
{puts("invalid sm3 entry length"); return NULL;}
238239
tableLength = p->Smbios30.StructureTableMaximumSize;
239240
tableAddress = (off_t) p->Smbios30.StructureTableAddress;
240241
break;
241242
}
242243
else if (memcmp(p, "_SM_", sizeof(p->Smbios20.AnchorString)) == 0)
243244
{
245+
puts("found SM2");
244246
if (p->Smbios20.EntryPointLength != sizeof(p->Smbios20))
245-
return NULL;
247+
{
248+
puts("invalid sm2 entry length");return NULL;}
246249
tableLength = p->Smbios20.StructureTableLength;
247250
tableAddress = (off_t) p->Smbios20.StructureTableAddress;
248251
break;
249252
}
250253
}
251254
if (tableLength == 0)
252-
return NULL;
253-
255+
{puts("nothing found");return NULL;}
256+
printf("found table length: %d\n", (int)tableLength);
254257
ffStrbufEnsureFixedLengthFree(&buffer, tableLength);
255258
if (pread(fd, buffer.chars, tableLength, tableAddress) == tableLength)
256259
{
260+
puts("pread(table) done");
257261
buffer.length = tableLength;
258262
buffer.chars[buffer.length] = '\0';
259263
}
260264
else
261-
return NULL;
265+
{perror("pread(table)");return NULL;}
262266
}
263267
#endif
264268

@@ -278,6 +282,8 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
278282
}
279283
}
280284

285+
puts("Everything is ok");
286+
281287
return &table;
282288
}
283289
#elif defined(_WIN32)

0 commit comments

Comments
 (0)