setos

拙OS
Log | Files | Refs | LICENSE

commit d35df0faa7faebfd81090978334c5362b167477d
parent f69e9f899a048a149673e09638e7bcd6cc6b8f33
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Wed, 24 Apr 2024 08:43:23 +0900

set DCBAAP
	need alignmen. this can be done by including stdalign.h and
		using alignas(64). but I don't want to use that.

Diffstat:
Msys/src/kernel/main.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/sys/src/kernel/main.c b/sys/src/kernel/main.c @@ -96,9 +96,17 @@ kernel_main(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) } xhc.op->CONFIG |= 1; // CONFIG.MaxSlotsEn cons_printf(&con0, "CONFIG: %x\n", xhc.op->CONFIG); + // TODO: align DCBAAP in 64-byte. xhc_device_context *DCBAAP[2] = {0}; + if (((uint64) DCBAAP&~(uint64)0x3f) != (uint64) DCBAAP) { + cons_printf(&con0, "DCBAAP not aligned: %x\n", (uint64) DCBAAP); + goto halt; + } xhc_device_context device_context; DCBAAP[1] = &device_context; + cons_printf(&con0, "DCBAAP: %x\n", xhc.op->DCBAAP); + xhc.op->DCBAAP = (uint64) DCBAAP&~(uint64)0x3f; + cons_printf(&con0, "DCBAAP: %x\n", xhc.op->DCBAAP); cons_printf(&con0, "local apic id: %x\n", *(uint32 *) (0xfee00020) >> 24); uintptr pci_config_base = (uintptr) pci_xhc;