user_space #4

Merged
mathieu merged 40 commits from user_space into master 2021-11-04 16:17:36 +01:00
2 changed files with 14 additions and 8 deletions
Showing only changes of commit 814d38bc97 - Show all commits

View File

@ -15,14 +15,16 @@ SUBDIRS := core drivers tests arch/$(ARCH)
INCDIRS += $(foreach dir, $(SUBDIRS), -I$(dir)) INCDIRS += $(foreach dir, $(SUBDIRS), -I$(dir))
CPPFLAGS += $(INCDIRS) CPPFLAGS += $(INCDIRS)
asmsrc=$(wildcard arch/$(ARCH)/boot/*.asm) asmsrc=
asmobj=$(asmsrc:%.asm=%.o) asmobj=$(asmsrc:%.asm=%.o)
gasmsrc=$(wildcard arch/$(ARCH)/*.S arch/$(ARCH)/boot/*.S)
gasmobj=$(gasmsrc:%.S=%.o)
csrc=$(shell find $(SUBDIRS) -type f -name "*.c")# $(wildcard *.c) csrc=$(shell find $(SUBDIRS) -type f -name "*.c")# $(wildcard *.c)
cobj=$(csrc:%.c=%.o) arch/$(ARCH)/cpu_context_switch.o arch/$(ARCH)/irq_pit.o arch/$(ARCH)/irq_wrappers.o arch/$(ARCH)/exception_wrappers.o arch/$(ARCH)/syscall_wrappers.o cobj=$(csrc:%.c=%.o)
deps = $(csrc:%.c=%.d) deps=$(csrc:%.c=%.d) $(gasmsrc:%.S=%.d)
kernel kernel.sym &: $(asmobj) $(cobj) linker.ld kernel kernel.sym &: $(asmobj) $(gasmobj) $(cobj) linker.ld
$(CC) -m32 -ffreestanding -nostdlib $(cobj) $(asmobj) -o kernel -T linker.ld -lgcc $(CC) -m32 -ffreestanding -nostdlib $(cobj) $(gasmobj) $(asmobj) -o kernel -T linker.ld -lgcc
objcopy --only-keep-debug kernel kernel.sym objcopy --only-keep-debug kernel kernel.sym
objcopy --strip-debug kernel objcopy --strip-debug kernel
@ -39,7 +41,7 @@ disk.img:
$(AS) $(ASFLAGS) -o $@ $< $(AS) $(ASFLAGS) -o $@ $<
%.o: %.S %.o: %.S
$(CC) $(INCDIRS) -c "$<" $(CFLAGS) -o "$@" $(CC) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
test: CFLAGS += -DRUN_TEST test: CFLAGS += -DRUN_TEST
@ -61,7 +63,7 @@ debug_test: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST
debug_test: debug debug_test: debug
clean: clean:
$(RM) kernel $(asmobj) $(cobj) $(deps) fd.iso kernel.sym $(RM) kernel $(asmobj) $(gasmobj) $(cobj) $(deps) fd.iso kernel.sym
$(RM) -r isodir $(RM) -r isodir
ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),clean)

View File

@ -31,7 +31,7 @@ stack is properly aligned and failure to align the stack will result in
undefined behavior. undefined behavior.
*/ */
.section .bss .section .bss
.align 16 .align 4096
stack_bottom: stack_bottom:
.skip 16384 # 16 KiB .skip 16384 # 16 KiB
stack_top: stack_top:
@ -117,3 +117,7 @@ Set the size of the _start symbol to the current location '.' minus its start.
This is useful when debugging or when you implement call tracing. This is useful when debugging or when you implement call tracing.
*/ */
.size _start, . - _start .size _start, . - _start
.global _stack_bottom
_stack_bottom: stack_bottom
.global _stack_stop
_stack_stop: stack_top