asm: Reorganise assembly code to avoid symlink use
diff --git a/stage23/Makefile b/stage23/Makefile
index e266db20..352de1e7 100644
--- a/stage23/Makefile
+++ b/stage23/Makefile
@@ -167,16 +167,22 @@ endif
C_FILES := $(shell find -L ./ -type f -name '*.c' | sort)
ifeq ($(TARGET), bios)
-ASM_FILES := $(shell find -L ./ -type f -name '*.asm' | sort)
-OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o))
+ASM32_FILES := $(shell find -L ./ -type f -name '*.asm32' | sort)
+ASMB_FILES := $(shell find -L ./ -type f -name '*.asmb' | sort)
+
+OBJ := $(addprefix $(BUILDDIR)/, $(ASM32_FILES:.asm32=.o) $(ASMB_FILES:.asmb=.o) $(C_FILES:.c=.o))
endif
ifeq ($(TARGET), uefi)
-ASM_FILES := $(shell find -L ./ -type f -name '*.asm64' | sort)
-OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm64=.o) $(C_FILES:.c=.o))
+ASM64_FILES := $(shell find -L ./ -type f -name '*.asm64' | sort)
+ASM64U_FILES := $(shell find -L ./ -type f -name '*.asm64u' | sort)
+
+OBJ := $(addprefix $(BUILDDIR)/, $(ASM64_FILES:.asm64=.o) $(ASM64U_FILES:.asm64u=.o) $(C_FILES:.c=.o))
endif
ifeq ($(TARGET), uefi32)
-ASM_FILES := $(shell find -L ./ -type f -name '*.asm32' | sort)
-OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm32=.o) $(C_FILES:.c=.o))
+ASM32_FILES := $(shell find -L ./ -type f -name '*.asm32' | sort)
+ASM32U_FILES := $(shell find -L ./ -type f -name '*.asm32u' | sort)
+
+OBJ := $(addprefix $(BUILDDIR)/, $(ASM32_FILES:.asm32=.o) $(ASM32U_FILES:.asm32u=.o) $(C_FILES:.c=.o))
endif
HEADER_DEPS := $(addprefix $(BUILDDIR)/, $(C_FILES:.c=.d))
@@ -336,18 +342,27 @@ $(BUILDDIR)/%.32.o: %.32.c $(BUILDDIR)/gnu-efi
endif
ifeq ($(TARGET), bios)
-$(BUILDDIR)/%.o: %.asm
+$(BUILDDIR)/%.o: %.asm32
+ nasm $< -F dwarf -g -Werror -f elf32 -o $@
+
+$(BUILDDIR)/%.o: %.asmb
nasm $< -F dwarf -g -Werror -f elf32 -o $@
endif
ifeq ($(TARGET), uefi)
$(BUILDDIR)/%.o: %.asm64
nasm $< -F dwarf -g -Werror -f elf64 -o $@
+
+$(BUILDDIR)/%.o: %.asm64u
+ nasm $< -F dwarf -g -Werror -f elf64 -o $@
endif
ifeq ($(TARGET), uefi32)
$(BUILDDIR)/%.o: %.asm32
nasm $< -F dwarf -g -Werror -f elf32 -o $@
+
+$(BUILDDIR)/%.o: %.asm32u
+ nasm $< -F dwarf -g -Werror -f elf32 -o $@
endif
clean:
diff --git a/stage23/entry.asm b/stage23/entry.asmb
similarity index 100%
rename from stage23/entry.asm
rename to stage23/entry.asmb
diff --git a/stage23/lib/libgcc.asm32 b/stage23/lib/libgcc.asm32
deleted file mode 120000
index 0aed883b..00000000
--- a/stage23/lib/libgcc.asm32
+++ /dev/null
@@ -1 +0,0 @@
-libgcc.s2.asm
\ No newline at end of file
diff --git a/stage23/lib/libgcc.s2.asm b/stage23/lib/libgcc.s2.asm32
similarity index 100%
rename from stage23/lib/libgcc.s2.asm
rename to stage23/lib/libgcc.s2.asm32
diff --git a/stage23/lib/pxe.asm b/stage23/lib/pxe.asmb
similarity index 100%
rename from stage23/lib/pxe.asm
rename to stage23/lib/pxe.asmb
diff --git a/stage23/lib/real.asm b/stage23/lib/real.asmb
similarity index 100%
rename from stage23/lib/real.asm
rename to stage23/lib/real.asmb
diff --git a/stage23/lib/sleep.asm b/stage23/lib/sleep.asmb
similarity index 100%
rename from stage23/lib/sleep.asm
rename to stage23/lib/sleep.asmb
diff --git a/stage23/lib/spinup.asm32 b/stage23/lib/spinup.asm32u
similarity index 100%
rename from stage23/lib/spinup.asm32
rename to stage23/lib/spinup.asm32u
diff --git a/stage23/lib/spinup.asm64 b/stage23/lib/spinup.asm64u
similarity index 100%
rename from stage23/lib/spinup.asm64
rename to stage23/lib/spinup.asm64u
diff --git a/stage23/lib/spinup.asm b/stage23/lib/spinup.asmb
similarity index 100%
rename from stage23/lib/spinup.asm
rename to stage23/lib/spinup.asmb
diff --git a/stage23/protos/stivale2_rt.asm32 b/stage23/protos/stivale2_rt.asm32u
similarity index 100%
rename from stage23/protos/stivale2_rt.asm32
rename to stage23/protos/stivale2_rt.asm32u
diff --git a/stage23/protos/stivale2_rt.asm b/stage23/protos/stivale2_rt.asmb
similarity index 100%
rename from stage23/protos/stivale2_rt.asm
rename to stage23/protos/stivale2_rt.asmb
diff --git a/stage23/sys/dummy_isr.asm b/stage23/sys/dummy_isr.asm
deleted file mode 100644
index 48cc17d3..00000000
--- a/stage23/sys/dummy_isr.asm
+++ /dev/null
@@ -1,8 +0,0 @@
-extern lapic_eoi
-
-global dummy_isr
-dummy_isr:
- pusha
- call lapic_eoi
- popa
- iretd
diff --git a/stage23/sys/dummy_isr.asm32 b/stage23/sys/dummy_isr.asm32
deleted file mode 120000
index 4d563df2..00000000
--- a/stage23/sys/dummy_isr.asm32
+++ /dev/null
@@ -1 +0,0 @@
-dummy_isr.asm
\ No newline at end of file
diff --git a/stage23/sys/dummy_isr.asm32 b/stage23/sys/dummy_isr.asm32
new file mode 100644
index 00000000..48cc17d3
--- /dev/null
+++ b/stage23/sys/dummy_isr.asm32
@@ -0,0 +1,8 @@
+extern lapic_eoi
+
+global dummy_isr
+dummy_isr:
+ pusha
+ call lapic_eoi
+ popa
+ iretd
diff --git a/stage23/sys/int_thunks.s2.asm b/stage23/sys/int_thunks.s2.asmb
similarity index 100%
rename from stage23/sys/int_thunks.s2.asm
rename to stage23/sys/int_thunks.s2.asmb
