Merge pull request #289 from ZystemOS/feature/remove-constants.zig

Remove constants.zig
This commit is contained in:
Sam Tebbs 2021-02-23 21:22:20 +00:00 committed by GitHub
commit d2da8a55bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 7 deletions

View file

@ -38,7 +38,6 @@ pub fn build(b: *Builder) !void {
const main_src = "src/kernel/kmain.zig"; const main_src = "src/kernel/kmain.zig";
const arch_root = "src/kernel/arch"; const arch_root = "src/kernel/arch";
const constants_path = try fs.path.join(b.allocator, &[_][]const u8{ arch_root, arch, "constants.zig" });
const linker_script_path = try fs.path.join(b.allocator, &[_][]const u8{ arch_root, arch, "link.ld" }); const linker_script_path = try fs.path.join(b.allocator, &[_][]const u8{ arch_root, arch, "link.ld" });
const output_iso = try fs.path.join(b.allocator, &[_][]const u8{ b.exe_dir, "pluto.iso" }); const output_iso = try fs.path.join(b.allocator, &[_][]const u8{ b.exe_dir, "pluto.iso" });
const iso_dir_path = try fs.path.join(b.allocator, &[_][]const u8{ b.exe_dir, "iso" }); const iso_dir_path = try fs.path.join(b.allocator, &[_][]const u8{ b.exe_dir, "iso" });
@ -60,7 +59,6 @@ pub fn build(b: *Builder) !void {
const disable_display = b.option(bool, "disable-display", "Disable the qemu window") orelse false; const disable_display = b.option(bool, "disable-display", "Disable the qemu window") orelse false;
const exec = b.addExecutable("pluto.elf", main_src); const exec = b.addExecutable("pluto.elf", main_src);
exec.addPackagePath("constants", constants_path);
exec.setOutputDir(b.cache_root); exec.setOutputDir(b.cache_root);
exec.addBuildOption(TestMode, "test_mode", test_mode); exec.addBuildOption(TestMode, "test_mode", test_mode);
exec.setBuildMode(build_mode); exec.setBuildMode(build_mode);
@ -108,7 +106,6 @@ pub fn build(b: *Builder) !void {
const unit_tests = b.addTest(main_src); const unit_tests = b.addTest(main_src);
unit_tests.setBuildMode(build_mode); unit_tests.setBuildMode(build_mode);
unit_tests.setMainPkgPath("."); unit_tests.setMainPkgPath(".");
unit_tests.addPackagePath("constants", constants_path);
unit_tests.addBuildOption(TestMode, "test_mode", test_mode); unit_tests.addBuildOption(TestMode, "test_mode", test_mode);
unit_tests.addBuildOption([]const u8, "mock_path", mock_path); unit_tests.addBuildOption([]const u8, "mock_path", mock_path);
unit_tests.addBuildOption([]const u8, "arch_mock_path", arch_mock_path); unit_tests.addBuildOption([]const u8, "arch_mock_path", arch_mock_path);

View file

@ -1,4 +1,3 @@
const constants = @import("constants");
const arch = @import("arch.zig"); const arch = @import("arch.zig");
/// The multiboot header /// The multiboot header
@ -13,7 +12,7 @@ const MEMINFO = 1 << 1;
const MAGIC = 0x1BADB002; const MAGIC = 0x1BADB002;
const FLAGS = ALIGN | MEMINFO; const FLAGS = ALIGN | MEMINFO;
const KERNEL_PAGE_NUMBER = constants.KERNEL_ADDR_OFFSET >> 22; const KERNEL_PAGE_NUMBER = 0xC0000000 >> 22;
// The number of pages occupied by the kernel, will need to be increased as we add a heap etc. // The number of pages occupied by the kernel, will need to be increased as we add a heap etc.
const KERNEL_NUM_PAGES = 1; const KERNEL_NUM_PAGES = 1;

View file

@ -1,2 +0,0 @@
/// The virtual address where the kernel will be loaded. This is at 3GB.
pub const KERNEL_ADDR_OFFSET = 0xC0000000;

View file

@ -1,5 +1,6 @@
ENTRY(_start) ENTRY(_start)
/* Changes to KERNEL_ADDR_OFFSET must also be made to KERNEL_PAGE_NUMBER in boot.zig */
KERNEL_ADDR_OFFSET = 0xC0000000; KERNEL_ADDR_OFFSET = 0xC0000000;
KERNEL_VADDR_START = 0xC0100000; KERNEL_VADDR_START = 0xC0100000;