Compare commits
45
Commits
master
..
c3ead56582
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3ead56582 | ||
|
|
15559b0a56 | ||
|
|
c58284761a | ||
|
|
bd99e429a9 | ||
|
|
d0acf5a718 | ||
|
|
b40151055c | ||
|
|
1e00d7a9e9 | ||
|
|
79b34477ed | ||
|
|
163ef9f79e | ||
|
|
3c549f0838 | ||
|
|
d8c85ad045 | ||
|
|
7c5af33ace | ||
|
|
6f3521c576 | ||
|
|
5a5d60abae | ||
|
|
9182a83ef2 | ||
|
|
195b7496f4 | ||
|
|
b1042fd649 | ||
|
|
6beb7da4cd | ||
|
|
f27851def9 | ||
|
|
18f1bfc88f | ||
|
|
cd6983e2cd | ||
|
|
8df1646c61 | ||
|
|
3e25ab6ae4 | ||
|
|
05cc2da2e3 | ||
|
|
a54536660b | ||
|
|
9e3d9b18ea | ||
|
|
ef01239468 | ||
|
|
372b7265f1 | ||
|
|
1bc8722098 | ||
|
|
cd2f3f9a84 | ||
|
|
08a35e40d4 | ||
|
|
a855702214 | ||
|
|
706f2c1c5d | ||
|
|
704fd15f7b | ||
|
|
f054bab5cc | ||
|
|
3fa8e4a24b | ||
|
|
a38f95a7b8 | ||
|
|
dd57a31d38 | ||
|
|
406f17c1db | ||
|
|
0be1b113aa | ||
|
|
d782b59768 | ||
|
|
c3a6139f83 | ||
|
|
3d3a433800 | ||
|
|
54451bcf5b | ||
|
|
1fc2dd34e5 |
No files matched your search
+1
-1
@@ -1,3 +1,3 @@
|
||||
.rscons*
|
||||
/i686-elf-gcc/
|
||||
/x86_64-elf-gcc/
|
||||
/build/
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "uefi-d"]
|
||||
path = uefi-d
|
||||
url = git://github.com/kubasz/uefi-d
|
||||
+84
-125
@@ -1,98 +1,52 @@
|
||||
path_prepend "i686-elf-gcc/bin"
|
||||
|
||||
configure do
|
||||
rscons "i686-elf-gcc.rb", "-b", "#{build_dir}/i686-elf-gcc"
|
||||
check_c_compiler "i686-elf-gcc"
|
||||
check_program "genext2fs"
|
||||
check_program "grub-mkstandalone"
|
||||
check_program "mformat", on_fail: "Install the mtools package"
|
||||
check_program "xorriso"
|
||||
check_cfg package: "freetype2", on_fail: "Install libfreetype-dev", use: "freetype"
|
||||
end
|
||||
|
||||
require "tmpdir"
|
||||
|
||||
# EFI (w/ GRUB) partition size (MiB)
|
||||
EFI_PART_SIZE = 8
|
||||
# HOS partition size (MiB)
|
||||
HOS_PART_SIZE = 4
|
||||
# Kernel default font size
|
||||
project_name "HOS"
|
||||
path_prepend "x86_64-elf-gcc/bin"
|
||||
|
||||
configure do
|
||||
rscons "x86_64-elf-gcc.rb", "-b", "#{build_dir}/x86_64-elf-gcc"
|
||||
check_d_compiler "ldc2", use: "ldc2"
|
||||
check_c_compiler "x86_64-w64-mingw32-gcc", use: "x86_64-w64-mingw32-gcc"
|
||||
check_c_compiler "x86_64-elf-gcc", use: "x86_64-elf-gcc"
|
||||
check_c_compiler
|
||||
check_program "mformat", on_fail: "Install the mtools package"
|
||||
check_cfg package: "freetype2", on_fail: "Install libfreetype-dev", use: "freetype"
|
||||
sh %w[git submodule update --init]
|
||||
end
|
||||
|
||||
# Kernel default font size.
|
||||
KFONT_SIZE = 15
|
||||
|
||||
class BiosImage < Builder
|
||||
class HulkBinObj < Builder
|
||||
def run(options)
|
||||
unless @cache.up_to_date?(@target, nil, @sources, @env)
|
||||
print_run_message("Generating BIOS boot image #{@target}", nil)
|
||||
Dir.mktmpdir do |tmpdir|
|
||||
# Create iso directory.
|
||||
FileUtils.mkdir_p("#{tmpdir}/iso/boot/grub")
|
||||
File.open("#{tmpdir}/iso/boot/grub/grub.cfg", "wb") do |fh|
|
||||
fh.write(<<EOF)
|
||||
set default="0"
|
||||
set timeout=1
|
||||
menuentry "HOS" {
|
||||
insmod multiboot2
|
||||
multiboot2 /hos.elf
|
||||
}
|
||||
FileUtils.mkdir_p(File.dirname(@target))
|
||||
File.write(@target, <<EOF)
|
||||
.section ".rodata"
|
||||
.balign 4096
|
||||
.global hulk_bin_start
|
||||
hulk_bin_start:
|
||||
.incbin "#{@sources.first}"
|
||||
.balign 4096
|
||||
.global hulk_bin_end
|
||||
hulk_bin_end:
|
||||
EOF
|
||||
end
|
||||
@sources.each do |source|
|
||||
FileUtils.cp(source, "#{tmpdir}/iso")
|
||||
end
|
||||
# Build bootable GRUB image.
|
||||
system(*%W[grub-mkrescue -o #{@target} #{tmpdir}/iso], err: "#{@env.build_root}/grub-mkrescue.log")
|
||||
end
|
||||
unless @cache.up_to_date?(@target, nil, @sources, @env)
|
||||
print_run_message("Creating HULK binary object <target>#{@target}<reset>", nil)
|
||||
@cache.register_build(@target, nil, @sources, @env)
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
class EfiImage < Builder
|
||||
class Image < Builder
|
||||
def run(options)
|
||||
unless @cache.up_to_date?(@target, nil, @sources, @env)
|
||||
print_run_message("Generating EFI boot image #{@target}", nil)
|
||||
Dir.mktmpdir do |tmpdir|
|
||||
# Build a standalone GRUB.
|
||||
File.open("#{tmpdir}/grub.cfg", "wb") do |fh|
|
||||
fh.write(<<EOF)
|
||||
insmod part_gpt
|
||||
configfile (hd0,gpt2)/grub.cfg
|
||||
EOF
|
||||
end
|
||||
system(*%W[grub-mkstandalone -O x86_64-efi -o #{tmpdir}/BOOTX64.EFI boot/grub/grub.cfg=#{tmpdir}/grub.cfg])
|
||||
# Create EFI partition.
|
||||
system(*%W[dd if=/dev/zero of=#{tmpdir}/efi.part bs=1M count=#{EFI_PART_SIZE}], err: "/dev/null")
|
||||
system(*%W[mformat -i #{tmpdir}/efi.part ::])
|
||||
system(*%W[mmd -i #{tmpdir}/efi.part ::/EFI])
|
||||
system(*%W[mmd -i #{tmpdir}/efi.part ::/EFI/BOOT])
|
||||
system(*%W[mcopy -i #{tmpdir}/efi.part #{tmpdir}/BOOTX64.EFI ::/EFI/BOOT])
|
||||
# Create ext2 HOS partition.
|
||||
FileUtils.mkdir_p("#{tmpdir}/ext2")
|
||||
@sources.each do |source|
|
||||
FileUtils.cp(source, "#{tmpdir}/ext2")
|
||||
end
|
||||
File.open("#{tmpdir}/ext2/grub.cfg", "wb") do |fh|
|
||||
fh.write(<<EOF)
|
||||
set default="0"
|
||||
set timeout=1
|
||||
menuentry "HOS" {
|
||||
insmod part_gpt
|
||||
insmod multiboot2
|
||||
set root=(hd0,gpt2)
|
||||
multiboot2 /hos.elf
|
||||
}
|
||||
EOF
|
||||
end
|
||||
system(*%W[genext2fs -b #{HOS_PART_SIZE * 1024} -d #{tmpdir}/ext2 #{tmpdir}/ext2.part])
|
||||
# Create full disk image.
|
||||
system(*%W[dd if=/dev/zero of=#{@target} bs=1M count=#{EFI_PART_SIZE + HOS_PART_SIZE + 2}], err: "/dev/null")
|
||||
system(*%W[parted -s #{@target} mklabel gpt])
|
||||
system(*%W[parted -s #{@target} mkpart efi 1MiB #{EFI_PART_SIZE + 1}MiB])
|
||||
system(*%W[parted -s #{@target} mkpart hos #{EFI_PART_SIZE + 1}MiB #{EFI_PART_SIZE + HOS_PART_SIZE + 1}MiB])
|
||||
system(*%W[dd if=#{tmpdir}/efi.part of=#{@target} bs=1M seek=1 conv=notrunc], err: "/dev/null")
|
||||
system(*%W[dd if=#{tmpdir}/ext2.part of=#{@target} bs=1M seek=#{1 + EFI_PART_SIZE} conv=notrunc], err: "/dev/null")
|
||||
end
|
||||
print_run_message("Creating disk image <target>#{@target}<reset>", nil)
|
||||
File.binwrite(@target, "\0" * (1440 * 1024))
|
||||
system(*%W[mformat -i #{@target} -f 1440 ::])
|
||||
system(*%W[mmd -i #{@target} ::/EFI])
|
||||
system(*%W[mmd -i #{@target} ::/EFI/BOOT])
|
||||
system(*%W[mcopy -i #{@target} #{@sources.first} ::/EFI/BOOT])
|
||||
@cache.register_build(@target, nil, @sources, @env)
|
||||
end
|
||||
true
|
||||
@@ -112,55 +66,60 @@ class FontGen < Builder
|
||||
end
|
||||
end
|
||||
|
||||
class Size < Builder
|
||||
def run(options)
|
||||
if @command
|
||||
finalize_command
|
||||
else
|
||||
@vars["_SOURCES"] = @sources
|
||||
@vars["_TARGET"] = @target
|
||||
command = @env.build_command(%w[${SIZE} ${_SOURCES}], @vars)
|
||||
standard_command("Size <target>#{@target}<reset>", command, stdout: @target)
|
||||
fontgen_env = env "fontgen", use: "freetype" do |env|
|
||||
env.Program("^/fontgen", glob("src/fontgen/**/*.c"))
|
||||
end
|
||||
|
||||
hulk_env = env "hulk", use: %w[ldc2 x86_64-elf-gcc] do |env|
|
||||
env["sources"] = glob("src/hulk/**/*.d")
|
||||
env["DFLAGS"] += %w[-mtriple=x86_64-unknown-elf --betterC -release -O3 --wi --enable-cross-module-inlining]
|
||||
env["D_IMPORT_PATH"] += %w[src]
|
||||
env["LD"] = "x86_64-elf-gcc"
|
||||
env["LDFLAGS"] += %w[-nostdlib -Tsrc/hulk/hulk.ld -Wl,-Map,${_TARGET}.map]
|
||||
env["LDCMD"] = %w[${LD} -o ${_TARGET} ${LDFLAGS} ${_SOURCES} ${LIBDIRPREFIX}${LIBPATH} ${LIBLINKPREFIX}${LIBS}]
|
||||
env["OBJDUMP"] = "x86_64-elf-objdump"
|
||||
env["OBJCOPY"] = "x86_64-elf-objcopy"
|
||||
env.Program("^/hulk.elf", "${sources}")
|
||||
env.depends("^/hulk.elf", "src/hulk/hulk.ld")
|
||||
env["SIZE"] = "x86_64-elf-size"
|
||||
env.Size("^/hulk.size", "^/hulk.elf")
|
||||
env.Disassemble("^/hulk.txt", "^/hulk.elf")
|
||||
env.Command("^/hulk.bin", "^/hulk.elf",
|
||||
"CMD" => %W[${OBJCOPY} -O binary ${_SOURCES} ${_TARGET}],
|
||||
"CMD_DESC" => "Convert ELF to binary:")
|
||||
env.add_build_hook do |builder|
|
||||
if builder.target.end_with?(".o")
|
||||
env.Disassemble("#{builder.target}.txt", builder.target)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# FontGen Environment
|
||||
fontgen_env = env "fontgen", use: "freetype" do |env|
|
||||
env["CC"] = "gcc"
|
||||
env.Program("^/fontgen.bin", glob("fontgen/**/*.c"))
|
||||
end
|
||||
|
||||
# Kernel Environment
|
||||
kernel_env = env "kernel" do |env|
|
||||
env.add_builder(EfiImage)
|
||||
env.add_builder(BiosImage)
|
||||
env.add_builder(FontGen)
|
||||
env.add_builder(Size)
|
||||
env["OBJDUMP"] = "i686-elf-objdump"
|
||||
env["SIZE"] = "i686-elf-size"
|
||||
env["CCFLAGS"] += %w[-ffreestanding -Wall -O2]
|
||||
env["LDFLAGS"] += %w[-ffreestanding -nostdlib -T src/link.ld]
|
||||
env["LDFLAGS"] += %W[-Wl,-Map,${_TARGET}.map]
|
||||
env["LIBS"] += %w[gcc]
|
||||
env.FontGen("^/kfont/kfont.c", "font/Hack-Regular.ttf",
|
||||
"fontgen" => fontgen_env.expand("^/fontgen.bin"))
|
||||
env.barrier
|
||||
env["CPPPATH"] += ["#{env.build_root}/kfont"]
|
||||
env.Program("^/hos.elf", glob("src/**/*.{S,c}") + ["^/kfont/kfont.c"])
|
||||
env.depends("#{env.build_root}/hos.elf", "src/link.ld")
|
||||
env.Disassemble("^/hos.elf.txt", "^/hos.elf")
|
||||
env.Size("^/hos.elf.size", "^/hos.elf")
|
||||
env.EfiImage("^/hos-efi.img", %w[^/hos.elf])
|
||||
env.BiosImage("^/hos.img", %w[^/hos.elf])
|
||||
hello_env = env "hello", use: %w[ldc2 x86_64-w64-mingw32-gcc] do |env|
|
||||
env.add_builder(Image)
|
||||
env.add_builder(HulkBinObj)
|
||||
env["sources"] = glob("src/hello/**/*.d")
|
||||
env["sources"] += glob("uefi-d/source/**/*.d")
|
||||
env.HulkBinObj("^/hulk_bin.S", hulk_env.expand("^/hulk.bin"))
|
||||
env.Object("^/hulk_bin.o", "^/hulk_bin.S")
|
||||
env.depends("^/hulk_bin.o", hulk_env.expand("^/hulk.bin"))
|
||||
env["sources"] << "^/hulk_bin.o"
|
||||
env["DFLAGS"] += %w[-mtriple=x86_64-unknown-windows-coff --betterC -release -O3 --wi --enable-cross-module-inlining]
|
||||
env["D_IMPORT_PATH"] += %w[src uefi-d/source]
|
||||
env["LD"] = "x86_64-w64-mingw32-gcc"
|
||||
env["LDFLAGS"] += %w[-nostdlib -Wl,-dll -shared -Wl,--subsystem,10 -e efi_main -Wl,-Map,${_TARGET}.map]
|
||||
env["LDCMD"] = %w[${LD} -o ${_TARGET} ${LDFLAGS} ${_SOURCES} ${LIBDIRPREFIX}${LIBPATH} ${LIBLINKPREFIX}${LIBS}]
|
||||
env["OBJDUMP"] = "x86_64-w64-mingw32-objdump"
|
||||
env.Program("^/BOOTX64.EFI", "${sources}")
|
||||
env["SIZE"] = "x86_64-w64-mingw32-size"
|
||||
env.Size("^/BOOTX64.size", "^/BOOTX64.EFI")
|
||||
env.Disassemble("^/BOOTX64.txt", "^/BOOTX64.EFI")
|
||||
env.Image("^/hos.img", "^/BOOTX64.EFI")
|
||||
end
|
||||
|
||||
task "run", desc: "Run HOS in QEMU" do
|
||||
img = kernel_env.expand("^/hos.img")
|
||||
sh %W[qemu-system-x86_64 -hda #{img}]
|
||||
end
|
||||
|
||||
task "run-efi", desc: "Run HOS EFI in QEMU" do
|
||||
img = kernel_env.expand("^/hos-efi.img")
|
||||
sh %W[qemu-system-x86_64 -bios OVMF.fd -hda #{img}]
|
||||
Dir.mktmpdir do |tmpdir|
|
||||
img = hello_env.expand("^/hos.img")
|
||||
FileUtils.cp(img, tmpdir)
|
||||
sh %W[qemu-system-x86_64 -bios OVMF.fd -drive file=#{tmpdir}/hos.img,format=raw]
|
||||
end
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# Copyright (c) 2013-2022 Josh Holtrop
|
||||
#
|
||||
#
|
||||
# MIT License
|
||||
#
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
@@ -11,10 +11,10 @@
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
@@ -24,7 +24,7 @@
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
script = File.join(File.dirname(__FILE__), ".rscons-3.0.0-077c0388ca4d1d902141299abcc4b8f6.rb")
|
||||
script = File.join(File.dirname(__FILE__), ".rscons-3.0.2-c49c635f1e4166223367979510498b28.rb")
|
||||
unless File.exists?(script)
|
||||
if File.read(__FILE__, mode: "rb") =~ /^#==>(.*)/
|
||||
require "zlib"
|
||||
@@ -43,4 +43,4 @@ load script
|
||||
if __FILE__ == $0
|
||||
Rscons::Cli.new.run(ARGV)
|
||||
end
|
||||
#==>eJztfWt3G0eO6Pf8inbbiUmZouzMndlzGCuSLMmJ9sqWryRnPUszHIpsSj0mu7ndpGStzP3tt4B6AVXVTcqP3Oye6zkTseuJQqFQKBQKePhga1EWWxdptpVk11GxuLj9rkj+Y5EWSRRnyXzraj6fxTZplF4m5Tz+bpqPFpMkOi2HeVZ+F0Xqey8rU/EVRcPJoCyj58+jMpmMMSWKTg/PDs+j7Sh+n3SfTmOVOkrG0U2RzpNGmreijWlSloPLpKlyRX7eH+aTvBAVZW/twWw2SYeDeZpnbZE7EH3KIqZOOjbV2lk62TEZrDlVd0d0bLtLspH5nS/mAG4capc0OVwURZLNLZgwTtplUgrcjSrz1ZDbyWB4JdqPPk0/kVzsddpOy/5gp3E2L9Lsssmyo2iSZkkpGp62S4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ZoKZJk1x004MbDpjhown97pIvt8KgIGI4IQYqDsi8Yx1U+0qY/5lqqw4AZxM2g+/3xZHBZNvC/5HCK3/Ii9YFzhaqyBLdIJpPGo2f+aby4pte6N3mBN25nUB4/1OUwa7P8kM6cS0RZNnThBjnstg1uSgUAMjkBePAP1IDBA4IkMn5MFfhCQqabSnENJy4wMCJWMjTjiaVwt40rMQmTZHUbeKCYIDVGePCY+LoyIJOJAIVI6uIFIt/BFAKYnj5gXwhQ4BYSDvgVDUnUdLGn4r+T3mrxDUFD19CsZ3NQDK+8E1Nt71Wb8f7+y+O9X86EXNlVYBBbvXDp44PVpTkGQliS196y97AAHt5plhfvv3kjuPeb08OXR++EcOsZF8gZ7qpyR68PoS+PyNgobMCMusz/CsjRkL50xNir8rYs8nz+NbqlQa09bzU1vmjujl7vrzVxb/bOf62ZNQfq8dGL46PX/3s1ZFGwjhh8sAdHp2tBXdFfmM9plm8Oby9vUvaCITBfUIVhPDBDThmvLdHKKL8pQy2tD2UmjS2/bXcB55v/Nmh52NVg9s40mEfPiEVTHbRJNTTbqbWhzaqhCUpdGxyYMBdz3EV3GvEmOy6sRmsVnCf3hLPm9CShCnLxeKUD+oLi2pMQiaDzgEsdWpapFIVQtgtl4IfXUn1xKcvMBmmBW7+Wk7kYI4RCJmKre5G9ohjcNnGrhm2aJlKWKGpLOdsVQzhebbkqaSV0PhwtplrEkqJv/2pQXkXbRhKe5/0rvwCe0lAZ17+4bfzQAdOkJtOEMM1iv5wXUhusr4Rupxf5pBntyDR5Eo5QZjb1guZW8KikpUESEyowJECNiu4hSm7mjE0srEJYWPdgJtXC61shQ2FusqKuI/UpBv50475OjZ2VRTQrtFcUSPgxpmjJ3HAuSqYIQQJrsFwyc+LT07eINNZfB2B9X3Xlr6POqG6HtpHqVcuwjEkLine truncated
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* HELLO console support.
|
||||
*/
|
||||
module hello.console;
|
||||
|
||||
import uefi;
|
||||
import hello.hello;
|
||||
import core.stdc.stdarg;
|
||||
|
||||
/**
|
||||
* Format a hexadecimal value to a string.
|
||||
*
|
||||
* @param s String buffer.
|
||||
* @param v Value to format.
|
||||
* @param ptr If true, always output all 16 digits, and separate the upper and
|
||||
* lower halves with an underscore.
|
||||
*/
|
||||
private size_t format_hex(CHAR16 * s, ulong v, bool ptr)
|
||||
{
|
||||
string hex_chars = "0123456789ABCDEF";
|
||||
bool print = ptr;
|
||||
size_t si = 0u;
|
||||
for (size_t i = 0u; i < 16u; i++)
|
||||
{
|
||||
if (ptr && (i == 8u))
|
||||
{
|
||||
s[si++] = '_';
|
||||
}
|
||||
ulong n = (v >> (60u - 4u * i)) & 0xFu;
|
||||
if (n != 0u)
|
||||
{
|
||||
print = true;
|
||||
}
|
||||
if (print || (i == 15u))
|
||||
{
|
||||
s[si++] = hex_chars[n];
|
||||
}
|
||||
}
|
||||
return si;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a decimal value to a string.
|
||||
*
|
||||
* @param s String buffer.
|
||||
* @param v Value to format.
|
||||
*/
|
||||
private size_t format_dec(CHAR16 * s, ulong v)
|
||||
{
|
||||
string dec_chars = "0123456789";
|
||||
bool print;
|
||||
char[20] buf;
|
||||
size_t buf_i;
|
||||
while ((buf_i == 0u) || (v != 0u))
|
||||
{
|
||||
ulong n = v % 10u;
|
||||
buf[buf_i++] = dec_chars[n];
|
||||
v /= 10u;
|
||||
}
|
||||
for (size_t si = 0u; si < buf_i; si++)
|
||||
{
|
||||
s[si] = buf[buf_i - si - 1u];
|
||||
}
|
||||
return buf_i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string to the console.
|
||||
*
|
||||
* @param s Format string.
|
||||
* @param args Variable arguments structure.
|
||||
*/
|
||||
void write(string s, va_list args)
|
||||
{
|
||||
__gshared static CHAR16[256] s16;
|
||||
size_t i = 0u;
|
||||
bool escape = false;
|
||||
foreach (char c; s)
|
||||
{
|
||||
if (escape)
|
||||
{
|
||||
if (c == '%')
|
||||
{
|
||||
s16[i++] = '%';
|
||||
}
|
||||
else if (c == 'x')
|
||||
{
|
||||
ulong v;
|
||||
va_arg(args, v);
|
||||
i += format_hex(&s16[i], v, false);
|
||||
}
|
||||
else if (c == 'p')
|
||||
{
|
||||
ulong v;
|
||||
va_arg(args, v);
|
||||
i += format_hex(&s16[i], v, true);
|
||||
}
|
||||
else if (c == 'S')
|
||||
{
|
||||
const(CHAR16) * s2;
|
||||
va_arg(args, s2);
|
||||
for (size_t s2_i = 0u; s2[s2_i] != 0; s2_i++)
|
||||
{
|
||||
s16[i++] = s2[s2_i];
|
||||
}
|
||||
}
|
||||
else if (c == 'u')
|
||||
{
|
||||
ulong v;
|
||||
va_arg(args, v);
|
||||
i += format_dec(&s16[i], v);
|
||||
}
|
||||
else
|
||||
{
|
||||
s16[i++] = c;
|
||||
}
|
||||
escape = false;
|
||||
}
|
||||
else if (c == '%')
|
||||
{
|
||||
escape = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
s16[i++] = c;
|
||||
}
|
||||
}
|
||||
s16[i++] = 0u;
|
||||
st.ConOut.OutputString(st.ConOut, &s16[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string to the console.
|
||||
*
|
||||
* @param s Format string.
|
||||
*/
|
||||
extern (C) void write(string s, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, s);
|
||||
write(s, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string to the console.
|
||||
*
|
||||
* @param s Format string.
|
||||
*/
|
||||
extern (C) void writeln(string s, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, s);
|
||||
write(s, args);
|
||||
write("\r\n", args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a message to press any key and wait for a key to be pressed.
|
||||
*/
|
||||
void wait_key()
|
||||
{
|
||||
writeln("Press any key...");
|
||||
st.ConIn.Reset(st.ConIn, FALSE);
|
||||
EFI_INPUT_KEY key;
|
||||
while (st.ConIn.ReadKeyStroke(st.ConIn, &key) == EFI_NOT_READY)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the console.
|
||||
*/
|
||||
void clear()
|
||||
{
|
||||
st.ConOut.ClearScreen(st.ConOut);
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
/**
|
||||
* HELLO, the HOS EFI Lightweight LOader.
|
||||
*/
|
||||
module hello.hello;
|
||||
|
||||
import uefi;
|
||||
import console = hello.console;
|
||||
import scratch = hello.scratch;
|
||||
import hulk.bootinfo;
|
||||
import hulk.header : HulkHeader = Header;
|
||||
import hos.page_table;
|
||||
import hos.cpu;
|
||||
import hos.memory;
|
||||
|
||||
__gshared EFI_SYSTEM_TABLE * st;
|
||||
private __gshared BootInfo bootinfo;
|
||||
private __gshared UINTN memory_map_key;
|
||||
extern extern(C) __gshared ubyte hulk_bin_start;
|
||||
|
||||
/**
|
||||
* Detect if we're running in QEMU.
|
||||
*/
|
||||
private bool in_qemu()
|
||||
{
|
||||
ulong * firmware_vendor = cast(ulong *) st.FirmwareVendor;
|
||||
ulong fv1 = firmware_vendor[0];
|
||||
return fv1 ==
|
||||
((cast(ulong)'E') |
|
||||
(cast(ulong)'D' << 16) |
|
||||
(cast(ulong)'K' << 32) |
|
||||
(cast(ulong)' ' << 48));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a graphics mode.
|
||||
*/
|
||||
private bool set_graphics_mode()
|
||||
{
|
||||
uint max_horizontal_resolution = in_qemu() ? 1920u : 0xFFFFFFFFu;
|
||||
UINTN buffer_size = scratch.free();
|
||||
EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
|
||||
EFI_HANDLE * handles = cast(EFI_HANDLE *)scratch.current();
|
||||
EFI_STATUS status = st.BootServices.LocateHandle(ByProtocol,
|
||||
&gop_guid, null, &buffer_size, handles);
|
||||
if (status != EFI_SUCCESS)
|
||||
{
|
||||
console.writeln("LocateHandle: error %x", status);
|
||||
return false;
|
||||
}
|
||||
EFI_HANDLE gop_handle = handles[0];
|
||||
EFI_HANDLE gop_interface;
|
||||
status = st.BootServices.HandleProtocol(gop_handle,
|
||||
&gop_guid, &gop_interface);
|
||||
if (status != EFI_SUCCESS)
|
||||
{
|
||||
console.writeln("HandleProtocol: error %x", status);
|
||||
return false;
|
||||
}
|
||||
if (gop_interface == null)
|
||||
{
|
||||
console.writeln("null interface from HandleProtocol");
|
||||
return false;
|
||||
}
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL * gop = cast(EFI_GRAPHICS_OUTPUT_PROTOCOL *)gop_interface;
|
||||
UINTN info_size;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * info;
|
||||
uint best_width;
|
||||
uint best_mode_number;
|
||||
for (uint mode_number = 0u;
|
||||
(status = gop.QueryMode(gop, mode_number, &info_size, &info)) == EFI_SUCCESS;
|
||||
mode_number++)
|
||||
{
|
||||
if ((info.HorizontalResolution > best_width) &&
|
||||
(info.HorizontalResolution <= max_horizontal_resolution))
|
||||
{
|
||||
best_width = info.HorizontalResolution;
|
||||
best_mode_number = mode_number;
|
||||
}
|
||||
st.BootServices.FreePool(info);
|
||||
}
|
||||
if ((status = gop.SetMode(gop, best_mode_number)) != EFI_SUCCESS)
|
||||
{
|
||||
console.writeln("SetMode: Error %x\n", status);
|
||||
return false;
|
||||
}
|
||||
bootinfo.fb.buffer = cast(uint *)gop.Mode.FrameBufferBase;
|
||||
bootinfo.fb.width = gop.Mode.Info.HorizontalResolution;
|
||||
bootinfo.fb.height = gop.Mode.Info.VerticalResolution;
|
||||
bootinfo.fb.stride = gop.Mode.Info.PixelsPerScanLine;
|
||||
bootinfo.fb.format = gop.Mode.Info.PixelFormat;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Walk the EFI memory map and translate it to the HULK bootinfo format.
|
||||
*
|
||||
* @return Maximum physical address to identity map.
|
||||
*/
|
||||
private ulong get_memory_map()
|
||||
{
|
||||
UINTN memory_map_size = scratch.free();
|
||||
UINTN descriptor_size;
|
||||
UINT32 descriptor_version;
|
||||
ubyte * scratch_base = scratch.current();
|
||||
UINTN status = st.BootServices.GetMemoryMap(
|
||||
&memory_map_size,
|
||||
cast(EFI_MEMORY_DESCRIPTOR *)scratch_base,
|
||||
&memory_map_key,
|
||||
&descriptor_size,
|
||||
&descriptor_version);
|
||||
if (status != EFI_SUCCESS)
|
||||
{
|
||||
console.writeln("GetMemoryMap: Error %x", status);
|
||||
return 0u;
|
||||
}
|
||||
ulong max_physical_address;
|
||||
size_t n_entries = memory_map_size / descriptor_size;
|
||||
size_t count;
|
||||
for (count = 0u; count < n_entries; count++)
|
||||
{
|
||||
if (count > bootinfo.memory_map.length)
|
||||
{
|
||||
console.writeln("Memory map too large");
|
||||
for (;;)
|
||||
{
|
||||
}
|
||||
}
|
||||
EFI_MEMORY_DESCRIPTOR * descriptor = cast(EFI_MEMORY_DESCRIPTOR *)&scratch_base[count * descriptor_size];
|
||||
ulong end_address = descriptor.PhysicalStart + descriptor.NumberOfPages * 4096u;
|
||||
if ((end_address > max_physical_address) &&
|
||||
((descriptor.Type == EfiLoaderCode) ||
|
||||
(descriptor.Type == EfiLoaderData) ||
|
||||
(descriptor.Type == EfiBootServicesCode) ||
|
||||
(descriptor.Type == EfiBootServicesData) ||
|
||||
(descriptor.Type == EfiRuntimeServicesCode) ||
|
||||
(descriptor.Type == EfiRuntimeServicesData) ||
|
||||
(descriptor.Type == EfiConventionalMemory)))
|
||||
{
|
||||
max_physical_address = end_address;
|
||||
}
|
||||
bootinfo.memory_map[count].base = descriptor.PhysicalStart;
|
||||
bootinfo.memory_map[count].size = descriptor.NumberOfPages * 4096u;
|
||||
bootinfo.memory_map[count].type = cast(ubyte)descriptor.Type;
|
||||
}
|
||||
bootinfo.memory_map_count = count;
|
||||
return max_physical_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a new page table.
|
||||
*/
|
||||
private PageTableEntry * new_page_table()
|
||||
{
|
||||
PageTableEntry * pt = cast(PageTableEntry *)scratch.alloc(1u);
|
||||
memset64(pt, 0u, 512);
|
||||
return pt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a virtual address to a physical address using 4KB pages.
|
||||
*
|
||||
* @param source_page Source page address.
|
||||
* @param dest_page Destination page address.
|
||||
* @param pt_base Page table base address.
|
||||
*/
|
||||
private void map4k(ulong source_page, ulong dest_page, PageTableEntry * pt_base)
|
||||
{
|
||||
PageTableEntry * pt = pt_base;
|
||||
PageTableEntry * next_pt;
|
||||
for (size_t level = 0; level < 4u; level++)
|
||||
{
|
||||
size_t pt_index = PageTableEntry.page_table_index(source_page, level);
|
||||
if (pt[pt_index].present())
|
||||
{
|
||||
pt = pt[pt_index].next();
|
||||
}
|
||||
else
|
||||
{
|
||||
ulong addr;
|
||||
if (level < 3u)
|
||||
{
|
||||
next_pt = new_page_table();
|
||||
addr = cast(ulong)next_pt;
|
||||
}
|
||||
else
|
||||
{
|
||||
addr = dest_page;
|
||||
}
|
||||
pt[pt_index] = PageTableEntry(addr,
|
||||
0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u);
|
||||
pt = next_pt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a virtual address to a physical address using 2MB pages.
|
||||
*
|
||||
* @param source_page Source page address.
|
||||
* @param dest_page Destination page address.
|
||||
* @param pt_base Page table base address.
|
||||
*/
|
||||
private void map2m(ulong source_page, ulong dest_page, PageTableEntry * pt_base)
|
||||
{
|
||||
PageTableEntry * pt = pt_base;
|
||||
PageTableEntry * next_pt;
|
||||
for (size_t level = 0; level < 3u; level++)
|
||||
{
|
||||
size_t pt_index = PageTableEntry.page_table_index(source_page, level);
|
||||
if (pt[pt_index].present())
|
||||
{
|
||||
pt = pt[pt_index].next();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (level < 2u)
|
||||
{
|
||||
next_pt = new_page_table();
|
||||
pt[pt_index] = PageTableEntry(cast(ulong)next_pt,
|
||||
0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u);
|
||||
}
|
||||
else
|
||||
{
|
||||
pt[pt_index] = PageTableEntry(dest_page,
|
||||
0u, 0u, 1u, 0u, 0u, 0u, 1u, 1u);
|
||||
}
|
||||
pt = next_pt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map HULK virtual addresses to physical kernel location.
|
||||
*
|
||||
* @param pt_base Page table base address.
|
||||
*/
|
||||
private void map_hulk(PageTableEntry * pt_base)
|
||||
{
|
||||
ulong virt = HULK_VIRTUAL_START;
|
||||
ulong phys = cast(ulong)&hulk_bin_start;
|
||||
HulkHeader * hulk_header = cast(HulkHeader *)&hulk_bin_start;
|
||||
size_t end_phys = phys + cast(size_t)hulk_header.total_size;
|
||||
while (phys < end_phys)
|
||||
{
|
||||
map4k(virt, phys, pt_base);
|
||||
virt += 4096u;
|
||||
phys += 4096u;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build page tables in preparation to jump to HULK.
|
||||
*
|
||||
* @param max_physical_address Maximum physical address to identity map.
|
||||
*/
|
||||
private void build_page_tables(ulong max_physical_address)
|
||||
{
|
||||
PageTableEntry * pt_base = new_page_table();
|
||||
/* Map physical RAM. */
|
||||
for (size_t addr = 0u; addr < max_physical_address; addr += (2u * 1024u * 1024u))
|
||||
{
|
||||
map2m(addr, addr, pt_base);
|
||||
}
|
||||
/* Map any memory regions that are outside physical RAM. */
|
||||
for (size_t i = 0u; i < bootinfo.memory_map_count; i++)
|
||||
{
|
||||
if (bootinfo.memory_map[i].base > max_physical_address)
|
||||
{
|
||||
for (size_t offset = 0u; offset < bootinfo.memory_map[i].size; offset += 4096u)
|
||||
{
|
||||
ulong addr = bootinfo.memory_map[i].base + offset;
|
||||
map4k(addr, addr, pt_base);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Map graphics framebuffer. */
|
||||
ulong framebuffer_size = bootinfo.fb.height * bootinfo.fb.stride * 4u;
|
||||
for (size_t offset = 0u; offset < framebuffer_size; offset += 4096u)
|
||||
{
|
||||
ulong addr = cast(ulong)bootinfo.fb.buffer + offset;
|
||||
map4k(addr, addr, pt_base);
|
||||
}
|
||||
/* Map HULK to its requested starting virtual address. */
|
||||
map_hulk(pt_base);
|
||||
/* Switch to the new page table. */
|
||||
write_cr3(cast(ulong)pt_base);
|
||||
}
|
||||
|
||||
/**
|
||||
* Jump to HULK entry point.
|
||||
*/
|
||||
private void jump_to_hulk()
|
||||
{
|
||||
HulkHeader * hulk_header = cast(HulkHeader *)&hulk_bin_start;
|
||||
void function(BootInfo *) hulk_start = cast(void function(BootInfo *))hulk_header.entry;
|
||||
hulk_start(&bootinfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* EFI application entry point.
|
||||
*
|
||||
* @param image_handle EFI application handle.
|
||||
* @param st Pointer to EFI system table.
|
||||
*/
|
||||
extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st)
|
||||
{
|
||||
.st = st;
|
||||
|
||||
console.clear();
|
||||
|
||||
console.writeln("HELLO, HOS EFI Lightweight LOader, v0.1.0");
|
||||
console.writeln("Firmware vendor: '%S', version: 0x%x", st.FirmwareVendor, st.FirmwareVendor);
|
||||
|
||||
if (!set_graphics_mode())
|
||||
{
|
||||
console.wait_key();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
ulong max_physical_address;
|
||||
for (;;)
|
||||
{
|
||||
max_physical_address = get_memory_map();
|
||||
|
||||
EFI_STATUS status = st.BootServices.ExitBootServices(image_handle, memory_map_key);
|
||||
if (status == EFI_INVALID_PARAMETER)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (status == EFI_SUCCESS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
console.writeln("ExitBootServices: Error %x", status);
|
||||
console.wait_key();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
build_page_tables(max_physical_address);
|
||||
|
||||
jump_to_hulk();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* HELLO scratch buffer.
|
||||
*/
|
||||
module hello.scratch;
|
||||
|
||||
/* Scratch buffer. */
|
||||
private align(4096) __gshared ubyte[1024 * 1024] scratch;
|
||||
|
||||
/* Number of scratch buffer bytes used. */
|
||||
private __gshared size_t scratch_used;
|
||||
|
||||
/**
|
||||
* Get the number of free bytes in the scratch buffer.
|
||||
*/
|
||||
size_t free()
|
||||
{
|
||||
return scratch.sizeof - scratch_used;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current free scratch buffer address.
|
||||
*/
|
||||
ubyte * current()
|
||||
{
|
||||
return &scratch[scratch_used];
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate pages from the scratch buffer.
|
||||
*/
|
||||
ubyte * alloc(size_t n = 1)
|
||||
{
|
||||
ubyte * address = &scratch[scratch_used];
|
||||
scratch_used += 4096u * n;
|
||||
return address;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import ldc.llvmasm;
|
||||
|
||||
ulong read_cr0()
|
||||
{
|
||||
return __asm!ulong("mov %cr0, %rax", "={rax}");
|
||||
}
|
||||
|
||||
ulong read_cr2()
|
||||
{
|
||||
return __asm!ulong("mov %cr2, %rax", "={rax}");
|
||||
}
|
||||
|
||||
ulong read_cr3()
|
||||
{
|
||||
return __asm!ulong("mov %cr3, %rax", "={rax}");
|
||||
}
|
||||
|
||||
void write_cr3(ulong v)
|
||||
{
|
||||
__asm("mov $0, %cr3", "r", v);
|
||||
}
|
||||
|
||||
ulong read_cr4()
|
||||
{
|
||||
return __asm!ulong("mov %cr4, %rax", "={rax}");
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import ldc.llvmasm;
|
||||
|
||||
void memset(void * dest, ubyte v, size_t n)
|
||||
{
|
||||
__asm("rep stosb",
|
||||
"{al},{rcx},{rdi},~{rcx},~{rdi},~{memory}",
|
||||
v, n, dest);
|
||||
}
|
||||
|
||||
void memset16(void * dest, ushort v, size_t n)
|
||||
{
|
||||
__asm("rep stosw",
|
||||
"{ax},{rcx},{rdi},~{rcx},~{rdi},~{memory}",
|
||||
v, n, dest);
|
||||
}
|
||||
|
||||
void memset32(void * dest, uint v, size_t n)
|
||||
{
|
||||
__asm("rep stosl",
|
||||
"{eax},{rcx},{rdi},~{rcx},~{rdi},~{memory}",
|
||||
v, n, dest);
|
||||
}
|
||||
|
||||
void memset64(void * dest, ulong v, size_t n)
|
||||
{
|
||||
__asm("rep stosq",
|
||||
"{rax},{rcx},{rdi},~{rcx},~{rdi},~{memory}",
|
||||
v, n, dest);
|
||||
}
|
||||
|
||||
void memcpy(void * dest, void * src, size_t n)
|
||||
{
|
||||
__asm("rep movsb",
|
||||
"{rcx},{rsi},{rdi},~{rcx},~{rsi},~{rdi},~{memory}",
|
||||
n, src, dest);
|
||||
}
|
||||
|
||||
void memcpy16(void * dest, void * src, size_t n)
|
||||
{
|
||||
__asm("rep movsw",
|
||||
"{rcx},{rsi},{rdi},~{rcx},~{rsi},~{rdi},~{memory}",
|
||||
n, src, dest);
|
||||
}
|
||||
|
||||
void memcpy32(void * dest, void * src, size_t n)
|
||||
{
|
||||
__asm("rep movsl",
|
||||
"{rcx},{rsi},{rdi},~{rcx},~{rsi},~{rdi},~{memory}",
|
||||
n, src, dest);
|
||||
}
|
||||
|
||||
void memcpy64(void * dest, void * src, size_t n)
|
||||
{
|
||||
__asm("rep movsq",
|
||||
"{rcx},{rsi},{rdi},~{rcx},~{rsi},~{rdi},~{memory}",
|
||||
n, src, dest);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
struct PageTableEntry
|
||||
{
|
||||
ulong entry;
|
||||
|
||||
this(ulong address, ulong no_execute, ulong global,
|
||||
ulong huge, ulong disable_cache, ulong write_through, ulong user,
|
||||
ulong writable, ulong present)
|
||||
{
|
||||
entry = (present |
|
||||
(writable << 1) |
|
||||
(user << 2) |
|
||||
(write_through << 3) |
|
||||
(disable_cache << 4) |
|
||||
(huge << 7) |
|
||||
(global << 8) |
|
||||
(no_execute << 63)) | address;
|
||||
}
|
||||
|
||||
bool present()
|
||||
{
|
||||
return (entry & 0x1u) != 0u;
|
||||
}
|
||||
|
||||
PageTableEntry * next()
|
||||
{
|
||||
return cast(PageTableEntry *)(entry & 0x7FFF_FFFF_FFFF_F000u);
|
||||
}
|
||||
|
||||
static ulong page_table_index(ulong address, size_t level)
|
||||
{
|
||||
return ((address >> (39u - 9u * level)) & 0x1FFu);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* HULK boot information.
|
||||
*/
|
||||
module hulk.bootinfo;
|
||||
|
||||
/**
|
||||
* HULK boot information structure.
|
||||
*/
|
||||
struct BootInfo
|
||||
{
|
||||
/**
|
||||
* Framebuffer description structure.
|
||||
*/
|
||||
struct Framebuffer
|
||||
{
|
||||
/** Framebuffer base address. */
|
||||
uint * buffer;
|
||||
/** Horizontal resolution. */
|
||||
uint width;
|
||||
/** Vertical resolution. */
|
||||
uint height;
|
||||
/** Number of pixels per scan line. */
|
||||
uint stride;
|
||||
/** Pixel format. */
|
||||
uint format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Memory map entry description structure.
|
||||
*/
|
||||
struct MemoryRegion
|
||||
{
|
||||
/** Base address of the memory region. */
|
||||
ulong base;
|
||||
/** Size in bytes of the memory region. */
|
||||
size_t size;
|
||||
/** Type of the memory region. */
|
||||
ubyte type;
|
||||
}
|
||||
|
||||
/* Framebuffer parameters. */
|
||||
Framebuffer fb;
|
||||
|
||||
/* Memory map. */
|
||||
MemoryRegion[800] memory_map;
|
||||
|
||||
/* Number of memory map entries. */
|
||||
size_t memory_map_count;
|
||||
}
|
||||
|
||||
/** HULK base virtual address. */
|
||||
enum ulong HULK_VIRTUAL_START = 0x0000_4000_0000_0000u;
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* HULK Framebuffer support.
|
||||
*/
|
||||
module hulk.framebuffer;
|
||||
|
||||
import hos.memory;
|
||||
|
||||
/**
|
||||
* Represent a graphical frame buffer.
|
||||
*
|
||||
* TODO: Handle other pixel formats. Currently only ARGB is supported.
|
||||
*/
|
||||
struct Framebuffer
|
||||
{
|
||||
/** Frame buffer base address. */
|
||||
private uint * m_buffer;
|
||||
|
||||
/** Frame buffer width. */
|
||||
private uint m_width;
|
||||
|
||||
/** Frame buffer height. */
|
||||
private uint m_height;
|
||||
|
||||
/** Frame buffer stride. */
|
||||
private uint m_stride;
|
||||
|
||||
/** Number of pixels in the frame buffer (whether visible or not). */
|
||||
private uint m_buffer_size;
|
||||
|
||||
/**
|
||||
* Initialize a frame buffer.
|
||||
*
|
||||
* @param buffer Frame buffer base address.
|
||||
* @param width Frame buffer width.
|
||||
* @param height Frame buffer height.
|
||||
* @param stride Frame buffer stride.
|
||||
*/
|
||||
void initialize(uint * buffer, uint width, uint height, uint stride)
|
||||
{
|
||||
m_buffer = buffer;
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_stride = stride;
|
||||
m_buffer_size = stride * height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the frame buffer to the given color.
|
||||
*
|
||||
* @param color Color to clear to.
|
||||
*/
|
||||
void clear(uint color = 0u)
|
||||
{
|
||||
memset32(m_buffer, color, m_buffer_size);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* HULK image header.
|
||||
*/
|
||||
module hulk.header;
|
||||
|
||||
/**
|
||||
* Header describing the HULK image.
|
||||
*/
|
||||
struct Header
|
||||
{
|
||||
/**
|
||||
* Total size of memory to be mapped.
|
||||
*
|
||||
* The OS loader must ensure that virtual memory is mapped for this entire
|
||||
* size.
|
||||
* This value is really an integer, but is stored as a pointer because it
|
||||
* is provided by the linker and LDC does not like us to cast it.
|
||||
*/
|
||||
void * total_size;
|
||||
|
||||
/** Entry point. */
|
||||
void * entry;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* HULK, the HOS Ultra Light Kernel.
|
||||
*/
|
||||
module hulk.hulk;
|
||||
|
||||
import hulk.header;
|
||||
import hulk.bootinfo;
|
||||
import hulk.framebuffer;
|
||||
import hos.memory;
|
||||
import ldc.attributes;
|
||||
|
||||
private __gshared Framebuffer fb;
|
||||
|
||||
extern extern(C) __gshared ubyte _hulk_total_size;
|
||||
|
||||
@(ldc.attributes.section(".hulk_header"))
|
||||
private __gshared Header hulk_header = {
|
||||
&_hulk_total_size,
|
||||
&hulk_start,
|
||||
};
|
||||
|
||||
/**
|
||||
* HULK entry point.
|
||||
*
|
||||
* @param bootinfo Pointer to HULK boot information structure.
|
||||
*/
|
||||
extern(C) void hulk_start(ulong rdi, ulong rsi, ulong rdx, BootInfo * bootinfo)
|
||||
{
|
||||
fb.initialize(bootinfo.fb.buffer, bootinfo.fb.width, bootinfo.fb.height, bootinfo.fb.stride);
|
||||
fb.clear(0xFF8800u);
|
||||
|
||||
for (size_t y = 100u; y < 120u; y++)
|
||||
{
|
||||
memset32(&bootinfo.fb.buffer[y * bootinfo.fb.stride + 20u], 0x001199u, 20u);
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x0000400000000000;
|
||||
_hulk_mem_start = .;
|
||||
|
||||
.rodata BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.hulk_header)
|
||||
*(.rodata)
|
||||
}
|
||||
|
||||
.text BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.data BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
|
||||
.bss BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(COMMON)
|
||||
*(.bss)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
|
||||
_hulk_mem_end = .;
|
||||
_hulk_total_size = _hulk_mem_end - _hulk_mem_start;
|
||||
}
|
||||
Submodule
+1
Submodule uefi-d added at e70959ce8a.
@@ -1,9 +1,10 @@
|
||||
project_name "x86_64-elf-gcc"
|
||||
binutils_version = "2.35"
|
||||
binutils_checksum = "1b11659fb49e20e18db460d44485f09442c8c56d5df165de9461eb09c8302f85"
|
||||
gcc_version = "10.2.0"
|
||||
gcc_checksum = "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c"
|
||||
install_path = File.expand_path("i686-elf-gcc")
|
||||
target = "i686-elf"
|
||||
install_path = File.expand_path("x86_64-elf-gcc")
|
||||
target = "x86_64-elf"
|
||||
path_prepend "#{install_path}/bin"
|
||||
|
||||
configure do
|
||||
@@ -53,7 +54,7 @@ default do
|
||||
cd "#{build_dir}/build-gcc" do
|
||||
sh %W[../gcc-#{gcc_version}/configure
|
||||
--target=#{target} --prefix=#{install_path} --disable-nls
|
||||
--enable-languages=c,c++ --without-headers]
|
||||
--enable-languages=c --without-headers]
|
||||
sh "make all-gcc"
|
||||
sh "make all-target-libgcc"
|
||||
sh "make install-gcc"
|
||||
Reference in new issue
Block a user