Revert "Host (Haiku): add debug log"

This reverts commit f3e54f33c2efb63bf9feb16bc202c8d8e5389cc8.
This commit is contained in:
李通洲 2025-02-15 19:47:16 +08:00
parent 532b3cd457
commit 34419d9bcf

View File

@ -234,46 +234,42 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
off_t tableAddress = 0; off_t tableAddress = 0;
FF_AUTO_CLOSE_FD int fd = open("/dev/misc/mem", O_RDONLY); FF_AUTO_CLOSE_FD int fd = open("/dev/misc/mem", O_RDONLY);
if (fd < 0) if (fd < 0)
{perror("open(mem)");return NULL;} return NULL;
FF_AUTO_FREE uint8_t* smBiosBase = malloc(0x10000); FF_AUTO_FREE uint8_t* smBiosBase = malloc(0x10000);
if (pread(fd, smBiosBase, 0x10000, 0xF0000) != 0x10000) if (pread(fd, smBiosBase, 0x10000, 0xF0000) != 0x10000)
{perror("pread(fd)");return NULL;} return NULL;
puts("read(mem) ok");
for (off_t offset = 0; offset <= 0xffe0; offset += 0x10) for (off_t offset = 0; offset <= 0xffe0; offset += 0x10)
{ {
FFSmbiosEntryPoint* p = (void*)(smBiosBase + offset); FFSmbiosEntryPoint* p = (void*)(smBiosBase + offset);
if (memcmp(p, "_SM3_", sizeof(p->Smbios30.AnchorString)) == 0) if (memcmp(p, "_SM3_", sizeof(p->Smbios30.AnchorString)) == 0)
{ {
puts("found SM3");
if (p->Smbios30.EntryPointLength != sizeof(p->Smbios30)) if (p->Smbios30.EntryPointLength != sizeof(p->Smbios30))
{puts("invalid sm3 entry length"); return NULL;} return NULL;
tableLength = p->Smbios30.StructureTableMaximumSize; tableLength = p->Smbios30.StructureTableMaximumSize;
tableAddress = (off_t) p->Smbios30.StructureTableAddress; tableAddress = (off_t) p->Smbios30.StructureTableAddress;
break; break;
} }
else if (memcmp(p, "_SM_", sizeof(p->Smbios20.AnchorString)) == 0) else if (memcmp(p, "_SM_", sizeof(p->Smbios20.AnchorString)) == 0)
{ {
puts("found SM2");
if (p->Smbios20.EntryPointLength != sizeof(p->Smbios20)) if (p->Smbios20.EntryPointLength != sizeof(p->Smbios20))
{ return NULL;
puts("invalid sm2 entry length");return NULL;}
tableLength = p->Smbios20.StructureTableLength; tableLength = p->Smbios20.StructureTableLength;
tableAddress = (off_t) p->Smbios20.StructureTableAddress; tableAddress = (off_t) p->Smbios20.StructureTableAddress;
break; break;
} }
} }
if (tableLength == 0) if (tableLength == 0)
{puts("nothing found");return NULL;} return NULL;
printf("found table length: %d\n", (int)tableLength);
ffStrbufEnsureFixedLengthFree(&buffer, tableLength); ffStrbufEnsureFixedLengthFree(&buffer, tableLength);
if (pread(fd, buffer.chars, tableLength, tableAddress) == tableLength) if (pread(fd, buffer.chars, tableLength, tableAddress) == tableLength)
{ {
puts("pread(table) done");
buffer.length = tableLength; buffer.length = tableLength;
buffer.chars[buffer.length] = '\0'; buffer.chars[buffer.length] = '\0';
} }
else else
{perror("pread(table)");return NULL;} return NULL;
} }
#endif #endif
@ -293,8 +289,6 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
} }
} }
puts("Everything is ok");
return &table; return &table;
} }
#elif defined(_WIN32) #elif defined(_WIN32)