Compare commits

..

No commits in common. "64190b04cbef9bf0fd0970f19fb749f724dd3e4b" and "59e084c234d43d9ffadfbaf5fc9062fd3dfe11c8" have entirely different histories.

3 changed files with 1 additions and 20 deletions

View File

@ -159,7 +159,7 @@ task "run", desc: "Run HOS in QEMU" do
Dir.mktmpdir do |tmpdir|
img = hello_env.expand("^/HOS.img")
FileUtils.cp(img, tmpdir)
sh %W[qemu-system-x86_64 -cpu max -bios OVMF.fd -drive file=#{tmpdir}/HOS.img,format=raw -device qemu-xhci -device usb-tablet]
sh %W[qemu-system-x86_64 -bios OVMF.fd -drive file=#{tmpdir}/HOS.img,format=raw -device qemu-xhci -device usb-tablet]
end
end

View File

@ -155,11 +155,6 @@ ulong read_cr0()
return __asm!ulong("mov %cr0, %rax", "={rax}");
}
void write_cr0(ulong v)
{
__asm("mov $0, %cr0", "r", v);
}
ulong read_cr2()
{
return __asm!ulong("mov %cr2, %rax", "={rax}");

View File

@ -33,26 +33,12 @@ private __gshared HulkHeader hulk_header = {
HULK_VIRTUAL_FRAMEBUFFER_ADDRESS, /* virt_fb_buffer */
};
private void initialize_cpu()
{
/* 1. Enable SSE. */
/* 1.a. Turn off CR0.EM and turn on CR0.MP. */
write_cr0((read_cr0() & ~CR0_EM) | CR0_MP);
/* 1.b. Set CR4.OSFXSR and CR4.OSXMMEXCPT. */
write_cr4(read_cr4() | CR4_OSFXSR | CR4_OSXMMEXCPT);
/* 2. Enable OSXSAVE. */
// write_cr4(read_cr4() | CR4_OSXSAVE);
/* 3. Enable AVX. */
// xsetbv(0u, xgetbv(0u) | XCR0_X87 | XCR0_SSE | XCR0_AVX);
}
/**
* HULK entry point.
*/
void hulk_start()
{
cli();
initialize_cpu();
gdt.initialize();
idt.initialize();
fb.initialize(cast(uint *)HULK_VIRTUAL_FRAMEBUFFER_ADDRESS, hulk_header.bootinfo.fb.width, hulk_header.bootinfo.fb.height, hulk_header.bootinfo.fb.stride);