Inserted some line print()'s for debugging

This commit is contained in:
Thomas Oltmann 2025-07-02 20:05:39 +02:00
parent c1f7148f30
commit 7126409aee

View file

@ -34,7 +34,7 @@
#define USE_MP_SERVICES 0 /* without fallback to ACPI parser and APIC INIT + SIPI */
#if BBDEBUG
#define DBG(fmt, ...) do{Print(fmt,__VA_ARGS__); }while(0);
#define DBG(fmt, ...) do{Print(fmt,__VA_ARGS__); }while(0)
#else
#define DBG(fmt, ...)
#endif
@ -1493,20 +1493,26 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
}
}
if(argc>1) {
configfile=argv[2];
configfile=argv[1];
} else {
configfile=L"\\BOOTBOOT\\CONFIG";
}
Print(L"Booting OS...\n");
#if 1
// get memory for bootboot structure
bootboot = NULL;
Print(L"LINE %d\n", (int)__LINE__ );
status = uefi_call_wrapper(BS->AllocatePages, 4, 0, 2, 1, (EFI_PHYSICAL_ADDRESS*)&bootboot);
Print(L"LINE %d\n", (int)__LINE__ );
if (EFI_ERROR(status) || bootboot == NULL)
return report(EFI_OUT_OF_RESOURCES,L"AllocatePages");
Print(L"LINE %d\n", (int)__LINE__ );
ZeroMem((void*)bootboot,PAGESIZE);
Print(L"LINE %d\n", (int)__LINE__ );
CopyMem(bootboot->magic,BOOTBOOT_MAGIC,4);
Print(L"LINE %d\n", (int)__LINE__ );
// unlike BIOS+MultiBoot bootboot, no need to check if we have
// PAE + MSR + LME, as we're already in long mode.
__asm__ __volatile__ (
@ -1515,10 +1521,14 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
"shrl $24, %%ebx;"
"mov %%bx,%0"
: "=b"(bootboot->bspid) : : );
Print(L"LINE %d\n", (int)__LINE__ );
#endif
#if !defined(USE_MP_SERVICES) || !USE_MP_SERVICES
// should be no need to check for RDSTC, available since Pentium, therefore
// all long mode capable CPUs should have it. But just to be on the safe side
__asm__ __volatile__ ("mov $1, %%eax; cpuid;" : "=d"(a) : : );
Print(L"LINE %d\n", (int)__LINE__ );
if(a & (1<<4)) {
// calibrate CPU clock cycles
__asm__ __volatile__ ( "rdtsc" : "=a"(a),"=d"(b)); currtime=((UINT64)b << 32)|a;
@ -1531,6 +1541,7 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
// fallback to dummy loops without RDTSC (should never happen)
ncycles = 0;
}
Print(L"LINE %d\n", (int)__LINE__ );
#define sleep(n) do { \
if(ncycles) { \
__asm__ __volatile__ ( "rdtsc" : "=a"(a),"=d"(b)); endtime=(((UINT64)b << 32)|a) + n*ncycles; \
@ -1546,6 +1557,7 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
*((volatile uint32_t*)(lapic_addr + 0x300)) = (*((volatile uint32_t*)(lapic_addr + 0x300)) & m) | v; \
} while(0)
#endif
Print(L"LINE %d\n", (int)__LINE__ );
// Try to locate HTTP service binding protocol
DBG(L" * Locating HTTP service binding protocol%s\n", L"");
@ -1553,6 +1565,7 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
if (EFI_ERROR(status)) {
return report(status, L"LocateProtocol");
}
Print(L"LINE %d\n", (int)__LINE__ );
// Create a HTTP protocol handle
DBG(L" * Creating HTTP protocol handle%s\n", L"");
@ -1561,6 +1574,7 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
if (EFI_ERROR(status)) {
return report(status, L"CreateChild");
}
Print(L"LINE %d\n", (int)__LINE__ );
status=EFI_LOAD_ERROR;