asm: Reorganise assembly code to avoid symlink use

This commit is contained in:
mintsuki 2021-10-22 15:45:47 +02:00
parent 4925f7e3dd
commit ffc461d3b9
15 changed files with 30 additions and 17 deletions

View File

@ -167,16 +167,22 @@ endif
C_FILES := $(shell find -L ./ -type f -name '*.c' | sort) C_FILES := $(shell find -L ./ -type f -name '*.c' | sort)
ifeq ($(TARGET), bios) ifeq ($(TARGET), bios)
ASM_FILES := $(shell find -L ./ -type f -name '*.asm' | sort) ASM32_FILES := $(shell find -L ./ -type f -name '*.asm32' | sort)
OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o)) 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 endif
ifeq ($(TARGET), uefi) ifeq ($(TARGET), uefi)
ASM_FILES := $(shell find -L ./ -type f -name '*.asm64' | sort) ASM64_FILES := $(shell find -L ./ -type f -name '*.asm64' | sort)
OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm64=.o) $(C_FILES:.c=.o)) 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 endif
ifeq ($(TARGET), uefi32) ifeq ($(TARGET), uefi32)
ASM_FILES := $(shell find -L ./ -type f -name '*.asm32' | sort) ASM32_FILES := $(shell find -L ./ -type f -name '*.asm32' | sort)
OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm32=.o) $(C_FILES:.c=.o)) 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 endif
HEADER_DEPS := $(addprefix $(BUILDDIR)/, $(C_FILES:.c=.d)) HEADER_DEPS := $(addprefix $(BUILDDIR)/, $(C_FILES:.c=.d))
@ -336,18 +342,27 @@ $(BUILDDIR)/%.32.o: %.32.c $(BUILDDIR)/gnu-efi
endif endif
ifeq ($(TARGET), bios) 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 $@ nasm $< -F dwarf -g -Werror -f elf32 -o $@
endif endif
ifeq ($(TARGET), uefi) ifeq ($(TARGET), uefi)
$(BUILDDIR)/%.o: %.asm64 $(BUILDDIR)/%.o: %.asm64
nasm $< -F dwarf -g -Werror -f elf64 -o $@ nasm $< -F dwarf -g -Werror -f elf64 -o $@
$(BUILDDIR)/%.o: %.asm64u
nasm $< -F dwarf -g -Werror -f elf64 -o $@
endif endif
ifeq ($(TARGET), uefi32) ifeq ($(TARGET), uefi32)
$(BUILDDIR)/%.o: %.asm32 $(BUILDDIR)/%.o: %.asm32
nasm $< -F dwarf -g -Werror -f elf32 -o $@ nasm $< -F dwarf -g -Werror -f elf32 -o $@
$(BUILDDIR)/%.o: %.asm32u
nasm $< -F dwarf -g -Werror -f elf32 -o $@
endif endif
clean: clean:

View File

@ -1 +0,0 @@
libgcc.s2.asm

View File

@ -1,8 +0,0 @@
extern lapic_eoi
global dummy_isr
dummy_isr:
pusha
call lapic_eoi
popa
iretd

View File

@ -1 +0,0 @@
dummy_isr.asm

View File

@ -0,0 +1,8 @@
extern lapic_eoi
global dummy_isr
dummy_isr:
pusha
call lapic_eoi
popa
iretd