zbs: fix i386

This commit is contained in:
Quinten Kock 2020-12-18 20:15:18 +01:00
parent da37355d83
commit 5a20cbd11b
5 changed files with 30 additions and 9 deletions

View File

@ -8,7 +8,7 @@ KERNEL_HDD = kornos.img
.DEFAULT_GOAL = $(KERNEL_HDD)
$(COMPONENTS):
$(MAKE) -C $@ bin/$@-$(ARCH)
$(MAKE) -C $@ $(ARCH)
disk: $(KERNEL_HDD)
run: $(KERNEL_HDD)

View File

@ -1,6 +1,6 @@
.PHONY: x86_64_stivale2 clean
x86_64_stivale2:
zig build -Dtarget="$@" --prefix bin
.PHONY: x86_64 i386 clean
x86_64 i386:
zig build -Dtarget="$@" --prefix .
clean:
rm -rf bin zig-cache

View File

@ -18,29 +18,49 @@ const Target = struct {
const x86 = Target{
.archdir = "x86",
.name = "x86-generic"
.name = "x86-generic",
};
const x86_64 = Target {
.parent = &x86,
.cpu_arch = std.Target.Cpu.Arch.x86_64,
.archdir = "x86_64",
.name = "x86_64-generic"
.name = "x86_64-generic",
};
const intel386 = Target {
.parent = &x86,
.cpu_arch = std.Target.Cpu.Arch.i386,
.archdir = "i386",
.name = "i386-generic",
};
const x86_64_stivale2 = Target {
.parent = &x86_64,
// .archdir = "x86_64/stivale2",
.linkscript = "make/x86_64/linker.ld",
.name = "x86_64-stivale2",
.name = "x86_64",
};
const i386_stivale2 = Target {
.parent = &intel386,
.linkscript = "make/i386/linker.ld",
.name = "i386",
};
const OutputTargets = &[_] Target {
x86_64_stivale2,
i386_stivale2,
};
const Targets = enum {
x86_64,
x86_64_stivale2,
i386,
i386_stivale2,
pub fn getTarget(self: Targets) Target {
return switch(self) {
.x86_64 => x86_64_stivale2,
.x86_64_stivale2 => x86_64_stivale2,
.i386 => i386_stivale2,
.i386_stivale2 => i386_stivale2,
};
}
pub fn default() Targets {

View File

@ -1,2 +0,0 @@
global archval
archval db "i386-nasm", 0

View File

@ -0,0 +1,3 @@
.global archval
archval:
.asciz "i386-gas"