:: commit 0673962817528949577df58c071873e76a7b4556

mintsuki <mintsuki@protonmail.com> — 2021-02-22 19:43

parents: 06476eb3f5

misc: Code reorganisation

diff --git a/Makefile b/Makefile
index a6f66170..5bc11540 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ DESTDIR =
 
 PATH := $(shell pwd)/toolchain/bin:$(PATH)
 
-.PHONY: all clean install tinf-clean bootloader bootloader-clean distclean stage2 stage2-clean decompressor decompressor-clean toolchain test.hdd echfs-test ext2-test fat32-test
+.PHONY: all clean install tinf-clean bootloader bootloader-clean distclean stages stages-clean decompressor decompressor-clean toolchain test.hdd echfs-test ext2-test fat32-test
 
 all: limine-install
 
@@ -26,16 +26,15 @@ install: all
 	install -d $(DESTDIR)$(PREFIX)/bin
 	install -s limine-install $(DESTDIR)$(PREFIX)/bin/
 
-bootloader: | decompressor stage2
-	gzip -n -9 < stage2/stage2.bin > stage2/stage2.bin.gz
-	cd bootsect && nasm bootsect.asm -fbin -o ../limine.bin
+bootloader: | decompressor stages
+	cd hddboot && nasm bootsect.asm -fbin -o ../limine-hdd.bin
 	cd cdboot && nasm bootsect.asm -fbin -o ../limine-cd.bin
 	cd pxeboot && nasm bootsect.asm -fbin -o ../limine-pxe.bin
-	cp stage2/stage2.map ./
-	cp stage2/stage3.bin ./limine.sys
+	cp stages/stages.map ./
+	cp stages/stage3.bin ./limine.sys
 
-bootloader-clean: stage2-clean decompressor-clean test-clean
-	rm -f stage2/stage2.bin.gz test/stage2.map test.hdd
+bootloader-clean: stages-clean decompressor-clean test-clean
+	rm -f test/stages.map test.hdd
 
 distclean: clean bootloader-clean
 	rm -rf stivale
@@ -47,11 +46,11 @@ stivale:
 	git clone https://github.com/stivale/stivale.git
 	cd stivale && git checkout d0a7ca5642d89654f8d688c2481c2771a8653c99
 
-stage2: tinf-clean stivale
-	$(MAKE) -C stage2 all
+stages: tinf-clean stivale
+	$(MAKE) -C stages all
 
-stage2-clean:
-	$(MAKE) -C stage2 clean
+stages-clean:
+	$(MAKE) -C stages clean
 
 decompressor: tinf-clean
 	$(MAKE) -C decompressor all
@@ -77,7 +76,7 @@ echfs-test: test.hdd bootloader | all
 	sed "s/@GUID@/`cat part_guid`/g" < test/limine.cfg > limine.cfg.tmp
 	echfs-utils -g -p0 test.hdd import limine.cfg.tmp limine.cfg
 	rm -f limine.cfg.tmp part_guid
-	echfs-utils -g -p0 test.hdd import stage2.map boot/stage2.map
+	echfs-utils -g -p0 test.hdd import stages.map boot/stages.map
 	echfs-utils -g -p0 test.hdd import test/test.elf boot/test.elf
 	echfs-utils -g -p0 test.hdd import test/bg.bmp boot/bg.bmp
 	./limine-install ./ test.hdd
@@ -86,7 +85,7 @@ echfs-test: test.hdd bootloader | all
 
 ext2-test: test.hdd bootloader | all
 	$(MAKE) -C test
-	cp stage2.map test/
+	cp stages.map test/
 	rm -rf test_image/
 	mkdir test_image
 	sudo losetup -Pf --show test.hdd > loopback_dev
@@ -104,7 +103,7 @@ ext2-test: test.hdd bootloader | all
 
 fat32-test: test.hdd bootloader | all
 	$(MAKE) -C test
-	cp stage2.map test/
+	cp stages.map test/
 	rm -rf test_image/
 	mkdir test_image
 	sudo losetup -Pf --show test.hdd > loopback_dev
@@ -122,9 +121,9 @@ fat32-test: test.hdd bootloader | all
 
 iso9660-test: bootloader
 	$(MAKE) -C test
-	cp stage2.map test/
+	cp stages.map test/
 	rm -rf test_image/
 	mkdir -p test_image/boot
-	cp -rv limine-cd.bin limine.sys stage2/stages.bin test/* test_image/boot/
+	cp -rv limine-cd.bin limine.sys stages/stages.bin test/* test_image/boot/
 	genisoimage -no-emul-boot -b boot/limine-cd.bin -o test.iso test_image/
 	qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -cdrom test.iso -debugcon stdio
diff --git a/cdboot/bootsect.asm b/cdboot/bootsect.asm
index 03a7ee60..adc1db28 100644
--- a/cdboot/bootsect.asm
+++ b/cdboot/bootsect.asm
@@ -82,7 +82,7 @@ err:
     jmp err
 
 %include 'iso9660.asm'
-%include '../bootsect/gdt.inc'
+%include '../hddboot/gdt.inc'
 
 BITS 32
 pmode:
diff --git a/bootsect/bootsect.asm b/hddboot/bootsect.asm
similarity index 98%
rename from bootsect/bootsect.asm
rename to hddboot/bootsect.asm
index 53d9bc85..c5722ba8 100644
--- a/bootsect/bootsect.asm
+++ b/hddboot/bootsect.asm
@@ -130,5 +130,5 @@ incbin '../decompressor/decompressor.bin'
 
 align 16
 stage2:
-incbin '../stage2/stage2.bin.gz'
+incbin '../stages/stage2.bin.gz'
 .size: equ $ - stage2
diff --git a/bootsect/disk.inc b/hddboot/disk.inc
similarity index 100%
rename from bootsect/disk.inc
rename to hddboot/disk.inc
diff --git a/bootsect/gdt.inc b/hddboot/gdt.inc
similarity index 100%
rename from bootsect/gdt.inc
rename to hddboot/gdt.inc
diff --git a/limine-pxe.bin b/limine-pxe.bin
index ed3eb420..9c268085 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.sys b/limine.sys
index 7b2d133c..53cac2c0 100644
Binary files a/limine.sys and b/limine.sys differ
diff --git a/pxeboot/bootsect.asm b/pxeboot/bootsect.asm
index ad033ef5..a003c506 100644
--- a/pxeboot/bootsect.asm
+++ b/pxeboot/bootsect.asm
@@ -50,7 +50,7 @@ err:
 
 ; Includes
 
-%include '../bootsect/gdt.inc'
+%include '../hddboot/gdt.inc'
 
 ; ********************* Stage 2 *********************
 
@@ -59,6 +59,6 @@ incbin '../decompressor/decompressor.bin'
 
 align 16
 stage2:
-incbin '../stage2/stage2.bin.gz'
+incbin '../stages/stage2.bin.gz'
 .size: equ $ - stage2
 .fullsize: equ $ - decompressor
diff --git a/stage2/Makefile b/stages/Makefile
similarity index 76%
rename from stage2/Makefile
rename to stages/Makefile
index e184deff..7ffaed8d 100644
--- a/stage2/Makefile
+++ b/stages/Makefile
@@ -45,22 +45,25 @@ ASM_FILES := $(shell find -L ./ -type f -name '*.asm' | sort)
 OBJ := $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o)
 HEADER_DEPS := $(C_FILES:.c=.d)
 
-all: stage2.map stage2.bin stage3.bin
+all: stages.map stages.bin stage2.bin stage2.bin.gz stage3.bin
+
+stage2.bin.gz: stage2.bin
+	gzip -n -9 < stage2.bin > stage2.bin.gz
 
 stage2.bin: stages.bin
-	dd if=stages.bin bs=$$(( 0x$$($(READELF) -S stage2.elf | grep .stage3 | sed 's/^.*] //' | awk '{print $$3}' | sed 's/^0*//') - 0x8000 )) count=1 of=$@
+	dd if=stages.bin bs=$$(( 0x$$($(READELF) -S stages.elf | grep .stage3 | sed 's/^.*] //' | awk '{print $$3}' | sed 's/^0*//') - 0x8000 )) count=1 of=$@
 
 stage3.bin: stages.bin
-	dd if=stages.bin bs=$$(( 0x$$($(READELF) -S stage2.elf | grep .stage3 | sed 's/^.*] //' | awk '{print $$3}' | sed 's/^0*//') - 0x8000 )) skip=1 of=$@
+	dd if=stages.bin bs=$$(( 0x$$($(READELF) -S stages.elf | grep .stage3 | sed 's/^.*] //' | awk '{print $$3}' | sed 's/^0*//') - 0x8000 )) skip=1 of=$@
 
-stage2.map: stage2.elf
+stages.map: stages.elf
 	./gensyms.sh $(OBJDUMP)
 	nasm symlist.gen -f bin -o $@
 
-stages.bin: stage2.elf
+stages.bin: stages.elf
 	$(OBJCOPY) -O binary $< $@
 
-stage2.elf: $(OBJ)
+stages.elf: $(OBJ)
 	$(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
 
 -include $(HEADER_DEPS)
@@ -72,4 +75,4 @@ stage2.elf: $(OBJ)
 	nasm $< -f elf32 -o $@
 
 clean:
-	rm -f symlist.gen stages.bin stage2.map stage2.bin stage2.elf stage3.bin $(OBJ) $(HEADER_DEPS)
+	rm -f symlist.gen stages.elf stages.map stages.bin stage2.bin stage2.bin.gz stage3.bin $(OBJ) $(HEADER_DEPS)
diff --git a/stage2/drivers/disk.c b/stages/drivers/disk.c
similarity index 100%
rename from stage2/drivers/disk.c
rename to stages/drivers/disk.c
diff --git a/stage2/drivers/disk.h b/stages/drivers/disk.h
similarity index 100%
rename from stage2/drivers/disk.h
rename to stages/drivers/disk.h
diff --git a/stage2/drivers/vbe.c b/stages/drivers/vbe.c
similarity index 100%
rename from stage2/drivers/vbe.c
rename to stages/drivers/vbe.c
diff --git a/stage2/drivers/vbe.h b/stages/drivers/vbe.h
similarity index 100%
rename from stage2/drivers/vbe.h
rename to stages/drivers/vbe.h
diff --git a/stage2/drivers/vga_textmode.c b/stages/drivers/vga_textmode.c
similarity index 100%
rename from stage2/drivers/vga_textmode.c
rename to stages/drivers/vga_textmode.c
diff --git a/stage2/drivers/vga_textmode.h b/stages/drivers/vga_textmode.h
similarity index 100%
rename from stage2/drivers/vga_textmode.h
rename to stages/drivers/vga_textmode.h
diff --git a/stage2/entry.asm b/stages/entry.asm
similarity index 100%
rename from stage2/entry.asm
rename to stages/entry.asm
diff --git a/stage2/fs/echfs.c b/stages/fs/echfs.c
similarity index 100%
rename from stage2/fs/echfs.c
rename to stages/fs/echfs.c
diff --git a/stage2/fs/echfs.h b/stages/fs/echfs.h
similarity index 100%
rename from stage2/fs/echfs.h
rename to stages/fs/echfs.h
diff --git a/stage2/fs/ext2.c b/stages/fs/ext2.c
similarity index 100%
rename from stage2/fs/ext2.c
rename to stages/fs/ext2.c
diff --git a/stage2/fs/ext2.h b/stages/fs/ext2.h
similarity index 100%
rename from stage2/fs/ext2.h
rename to stages/fs/ext2.h
diff --git a/stage2/fs/fat32.c b/stages/fs/fat32.c
similarity index 100%
rename from stage2/fs/fat32.c
rename to stages/fs/fat32.c
diff --git a/stage2/fs/fat32.h b/stages/fs/fat32.h
similarity index 100%
rename from stage2/fs/fat32.h
rename to stages/fs/fat32.h
diff --git a/stage2/fs/file.c b/stages/fs/file.c
similarity index 100%
rename from stage2/fs/file.c
rename to stages/fs/file.c
diff --git a/stage2/fs/file.h b/stages/fs/file.h
similarity index 100%
rename from stage2/fs/file.h
rename to stages/fs/file.h
diff --git a/stage2/fs/iso9660.c b/stages/fs/iso9660.c
similarity index 83%
rename from stage2/fs/iso9660.c
rename to stages/fs/iso9660.c
index 978ef1c8..ae5b4b0a 100644
--- a/stage2/fs/iso9660.c
+++ b/stages/fs/iso9660.c
@@ -68,11 +68,6 @@ struct iso9660_primary_volume {
 
 
 // --- Implementation ---
-struct iso9660_contexts_node {
-    struct iso9660_context context;
-    struct iso9660_contexts_node *next;
-};
-stage3_data struct iso9660_contexts_node *contexts = NULL;
 
 stage3_text static void iso9660_find_PVD(struct iso9660_volume_descriptor *desc, struct volume *vol) {
     uint32_t lba = ISO9660_FIRST_VOLUME_DESCRIPTOR;
@@ -102,24 +97,6 @@ stage3_text static void iso9660_cache_root(struct volume *vol,
     volume_read(vol, *root, pv.root.extent.little * ISO9660_SECTOR_SIZE, *root_size);
 }
 
-stage3_text static struct iso9660_context *iso9660_get_context(struct volume *vol) {
-    struct iso9660_contexts_node *current = contexts;
-    while (current) {
-        if (current->context.vol.drive == vol->drive)
-            return &current->context;
-        current = current->next;
-    }
-
-    // The context is not cached at this point
-    struct iso9660_contexts_node *node = ext_mem_alloc(sizeof(struct iso9660_contexts_node));
-    node->context.vol = *vol;
-    iso9660_cache_root(vol, &node->context.root, &node->context.root_size);
-
-    node->next = contexts;
-    contexts = node;
-    return &node->context;
-}
-
 stage3_text static int iso9660_strcmp(const char *a, const char *b, size_t size) {
     while (size--) {
         char ca = *a++;
@@ -169,13 +146,15 @@ stage3_text int iso9660_check_signature(struct volume *vol) {
 }
 
 stage3_text int iso9660_open(struct iso9660_file_handle *ret, struct volume *vol, const char *path) {
-    ret->context = iso9660_get_context(vol);
+    iso9660_cache_root(vol, &ret->context.root, &ret->context.root_size);
+
+    ret->context.vol = *vol;
 
     while (*path == '/')
         ++path;
 
-    struct iso9660_directory_entry *current = ret->context->root;
-    uint32_t current_size = ret->context->root_size;
+    struct iso9660_directory_entry *current = ret->context.root;
+    uint32_t current_size = ret->context.root_size;
 
     uint32_t next_sector = 0;
     uint32_t next_size = 0;
@@ -208,6 +187,6 @@ stage3_text int iso9660_open(struct iso9660_file_handle *ret, struct volume *vol
 }
 
 stage3_text int iso9660_read(struct iso9660_file_handle *file, void *buf, uint64_t loc, uint64_t count) {
-    volume_read(&file->context->vol, buf, file->LBA * ISO9660_SECTOR_SIZE + loc, count);
+    volume_read(&file->context.vol, buf, file->LBA * ISO9660_SECTOR_SIZE + loc, count);
     return 0;
 }
diff --git a/stage2/fs/iso9660.h b/stages/fs/iso9660.h
similarity index 93%
rename from stage2/fs/iso9660.h
rename to stages/fs/iso9660.h
index 02c5552a..ebd0cb5a 100644
--- a/stage2/fs/iso9660.h
+++ b/stages/fs/iso9660.h
@@ -13,7 +13,7 @@ struct iso9660_context {
 };
 
 struct iso9660_file_handle {
-    struct iso9660_context *context;
+    struct iso9660_context context;
     uint32_t LBA;
     uint32_t size;
 };
diff --git a/stage2/gensyms.sh b/stages/gensyms.sh
similarity index 100%
rename from stage2/gensyms.sh
rename to stages/gensyms.sh
diff --git a/stage2/lib/acpi.c b/stages/lib/acpi.c
similarity index 100%
rename from stage2/lib/acpi.c
rename to stages/lib/acpi.c
diff --git a/stage2/lib/acpi.h b/stages/lib/acpi.h
similarity index 100%
rename from stage2/lib/acpi.h
rename to stages/lib/acpi.h
diff --git a/stage2/lib/blib.c b/stages/lib/blib.c
similarity index 100%
rename from stage2/lib/blib.c
rename to stages/lib/blib.c
diff --git a/stage2/lib/blib.h b/stages/lib/blib.h
similarity index 100%
rename from stage2/lib/blib.h
rename to stages/lib/blib.h
diff --git a/stage2/lib/bmp.c b/stages/lib/bmp.c
similarity index 100%
rename from stage2/lib/bmp.c
rename to stages/lib/bmp.c
diff --git a/stage2/lib/bmp.h b/stages/lib/bmp.h
similarity index 100%
rename from stage2/lib/bmp.h
rename to stages/lib/bmp.h
diff --git a/stage2/lib/builtins.asm b/stages/lib/builtins.asm
similarity index 100%
rename from stage2/lib/builtins.asm
rename to stages/lib/builtins.asm
diff --git a/stage2/lib/config.c b/stages/lib/config.c
similarity index 100%
rename from stage2/lib/config.c
rename to stages/lib/config.c
diff --git a/stage2/lib/config.h b/stages/lib/config.h
similarity index 100%
rename from stage2/lib/config.h
rename to stages/lib/config.h
diff --git a/stage2/lib/elf.c b/stages/lib/elf.c
similarity index 100%
rename from stage2/lib/elf.c
rename to stages/lib/elf.c
diff --git a/stage2/lib/elf.h b/stages/lib/elf.h
similarity index 100%
rename from stage2/lib/elf.h
rename to stages/lib/elf.h
diff --git a/stage2/lib/guid.c b/stages/lib/guid.c
similarity index 100%
rename from stage2/lib/guid.c
rename to stages/lib/guid.c
diff --git a/stage2/lib/guid.h b/stages/lib/guid.h
similarity index 100%
rename from stage2/lib/guid.h
rename to stages/lib/guid.h
diff --git a/stage2/lib/image.c b/stages/lib/image.c
similarity index 100%
rename from stage2/lib/image.c
rename to stages/lib/image.c
diff --git a/stage2/lib/image.h b/stages/lib/image.h
similarity index 100%
rename from stage2/lib/image.h
rename to stages/lib/image.h
diff --git a/stage2/lib/libc.c b/stages/lib/libc.c
similarity index 100%
rename from stage2/lib/libc.c
rename to stages/lib/libc.c
diff --git a/stage2/lib/libc.h b/stages/lib/libc.h
similarity index 100%
rename from stage2/lib/libc.h
rename to stages/lib/libc.h
diff --git a/stage2/lib/part.c b/stages/lib/part.c
similarity index 100%
rename from stage2/lib/part.c
rename to stages/lib/part.c
diff --git a/stage2/lib/part.h b/stages/lib/part.h
similarity index 100%
rename from stage2/lib/part.h
rename to stages/lib/part.h
diff --git a/stage2/lib/print.c b/stages/lib/print.c
similarity index 100%
rename from stage2/lib/print.c
rename to stages/lib/print.c
diff --git a/stage2/lib/print.h b/stages/lib/print.h
similarity index 100%
rename from stage2/lib/print.h
rename to stages/lib/print.h
diff --git a/stage2/lib/pxe.asm b/stages/lib/pxe.asm
similarity index 100%
rename from stage2/lib/pxe.asm
rename to stages/lib/pxe.asm
diff --git a/stage2/lib/rand.c b/stages/lib/rand.c
similarity index 100%
rename from stage2/lib/rand.c
rename to stages/lib/rand.c
diff --git a/stage2/lib/rand.h b/stages/lib/rand.h
similarity index 100%
rename from stage2/lib/rand.h
rename to stages/lib/rand.h
diff --git a/stage2/lib/readline.c b/stages/lib/readline.c
similarity index 100%
rename from stage2/lib/readline.c
rename to stages/lib/readline.c
diff --git a/stage2/lib/readline.h b/stages/lib/readline.h
similarity index 100%
rename from stage2/lib/readline.h
rename to stages/lib/readline.h
diff --git a/stage2/lib/real.asm b/stages/lib/real.asm
similarity index 100%
rename from stage2/lib/real.asm
rename to stages/lib/real.asm
diff --git a/stage2/lib/real.h b/stages/lib/real.h
similarity index 100%
rename from stage2/lib/real.h
rename to stages/lib/real.h
diff --git a/stage2/lib/sleep.asm b/stages/lib/sleep.asm
similarity index 100%
rename from stage2/lib/sleep.asm
rename to stages/lib/sleep.asm
diff --git a/stage2/lib/term.c b/stages/lib/term.c
similarity index 100%
rename from stage2/lib/term.c
rename to stages/lib/term.c
diff --git a/stage2/lib/term.h b/stages/lib/term.h
similarity index 100%
rename from stage2/lib/term.h
rename to stages/lib/term.h
diff --git a/stage2/lib/time.c b/stages/lib/time.c
similarity index 100%
rename from stage2/lib/time.c
rename to stages/lib/time.c
diff --git a/stage2/lib/time.h b/stages/lib/time.h
similarity index 100%
rename from stage2/lib/time.h
rename to stages/lib/time.h
diff --git a/stage2/lib/trace.c b/stages/lib/trace.c
similarity index 100%
rename from stage2/lib/trace.c
rename to stages/lib/trace.c
diff --git a/stage2/lib/trace.h b/stages/lib/trace.h
similarity index 100%
rename from stage2/lib/trace.h
rename to stages/lib/trace.h
diff --git a/stage2/lib/uri.c b/stages/lib/uri.c
similarity index 100%
rename from stage2/lib/uri.c
rename to stages/lib/uri.c
diff --git a/stage2/lib/uri.h b/stages/lib/uri.h
similarity index 100%
rename from stage2/lib/uri.h
rename to stages/lib/uri.h
diff --git a/stage2/linker.ld b/stages/linker.ld
similarity index 100%
rename from stage2/linker.ld
rename to stages/linker.ld
diff --git a/stage2/main.c b/stages/main.c
similarity index 100%
rename from stage2/main.c
rename to stages/main.c
diff --git a/stage2/menu.c b/stages/menu.c
similarity index 100%
rename from stage2/menu.c
rename to stages/menu.c
diff --git a/stage2/menu.h b/stages/menu.h
similarity index 100%
rename from stage2/menu.h
rename to stages/menu.h
diff --git a/stage2/mm/mtrr.c b/stages/mm/mtrr.c
similarity index 100%
rename from stage2/mm/mtrr.c
rename to stages/mm/mtrr.c
diff --git a/stage2/mm/mtrr.h b/stages/mm/mtrr.h
similarity index 100%
rename from stage2/mm/mtrr.h
rename to stages/mm/mtrr.h
diff --git a/stage2/mm/pmm.c b/stages/mm/pmm.c
similarity index 100%
rename from stage2/mm/pmm.c
rename to stages/mm/pmm.c
diff --git a/stage2/mm/pmm.h b/stages/mm/pmm.h
similarity index 100%
rename from stage2/mm/pmm.h
rename to stages/mm/pmm.h
diff --git a/stage2/mm/vmm.c b/stages/mm/vmm.c
similarity index 100%
rename from stage2/mm/vmm.c
rename to stages/mm/vmm.c
diff --git a/stage2/mm/vmm.h b/stages/mm/vmm.h
similarity index 100%
rename from stage2/mm/vmm.h
rename to stages/mm/vmm.h
diff --git a/stage2/protos/chainload.c b/stages/protos/chainload.c
similarity index 100%
rename from stage2/protos/chainload.c
rename to stages/protos/chainload.c
diff --git a/stage2/protos/chainload.h b/stages/protos/chainload.h
similarity index 100%
rename from stage2/protos/chainload.h
rename to stages/protos/chainload.h
diff --git a/stage2/protos/linux.c b/stages/protos/linux.c
similarity index 100%
rename from stage2/protos/linux.c
rename to stages/protos/linux.c
diff --git a/stage2/protos/linux.h b/stages/protos/linux.h
similarity index 100%
rename from stage2/protos/linux.h
rename to stages/protos/linux.h
diff --git a/stage2/protos/stivale.c b/stages/protos/stivale.c
similarity index 100%
rename from stage2/protos/stivale.c
rename to stages/protos/stivale.c
diff --git a/stage2/protos/stivale.h b/stages/protos/stivale.h
similarity index 100%
rename from stage2/protos/stivale.h
rename to stages/protos/stivale.h
diff --git a/stage2/protos/stivale2.c b/stages/protos/stivale2.c
similarity index 100%
rename from stage2/protos/stivale2.c
rename to stages/protos/stivale2.c
diff --git a/stage2/protos/stivale2.h b/stages/protos/stivale2.h
similarity index 100%
rename from stage2/protos/stivale2.h
rename to stages/protos/stivale2.h
diff --git a/stage2/pxe/pxe.c b/stages/pxe/pxe.c
similarity index 100%
rename from stage2/pxe/pxe.c
rename to stages/pxe/pxe.c
diff --git a/stage2/pxe/pxe.h b/stages/pxe/pxe.h
similarity index 100%
rename from stage2/pxe/pxe.h
rename to stages/pxe/pxe.h
diff --git a/stage2/pxe/tftp.c b/stages/pxe/tftp.c
similarity index 100%
rename from stage2/pxe/tftp.c
rename to stages/pxe/tftp.c
diff --git a/stage2/pxe/tftp.h b/stages/pxe/tftp.h
similarity index 100%
rename from stage2/pxe/tftp.h
rename to stages/pxe/tftp.h
diff --git a/stage2/sys/a20.c b/stages/sys/a20.c
similarity index 100%
rename from stage2/sys/a20.c
rename to stages/sys/a20.c
diff --git a/stage2/sys/a20.h b/stages/sys/a20.h
similarity index 100%
rename from stage2/sys/a20.h
rename to stages/sys/a20.h
diff --git a/stage2/sys/cpu.h b/stages/sys/cpu.h
similarity index 100%
rename from stage2/sys/cpu.h
rename to stages/sys/cpu.h
diff --git a/stage2/sys/e820.c b/stages/sys/e820.c
similarity index 100%
rename from stage2/sys/e820.c
rename to stages/sys/e820.c
diff --git a/stage2/sys/e820.h b/stages/sys/e820.h
similarity index 100%
rename from stage2/sys/e820.h
rename to stages/sys/e820.h
diff --git a/stage2/sys/gdt.asm b/stages/sys/gdt.asm
similarity index 100%
rename from stage2/sys/gdt.asm
rename to stages/sys/gdt.asm
diff --git a/stage2/sys/lapic.c b/stages/sys/lapic.c
similarity index 100%
rename from stage2/sys/lapic.c
rename to stages/sys/lapic.c
diff --git a/stage2/sys/lapic.h b/stages/sys/lapic.h
similarity index 100%
rename from stage2/sys/lapic.h
rename to stages/sys/lapic.h
diff --git a/stage2/sys/pic.c b/stages/sys/pic.c
similarity index 100%
rename from stage2/sys/pic.c
rename to stages/sys/pic.c
diff --git a/stage2/sys/pic.h b/stages/sys/pic.h
similarity index 100%
rename from stage2/sys/pic.h
rename to stages/sys/pic.h
diff --git a/stage2/sys/smp.c b/stages/sys/smp.c
similarity index 100%
rename from stage2/sys/smp.c
rename to stages/sys/smp.c
diff --git a/stage2/sys/smp.h b/stages/sys/smp.h
similarity index 100%
rename from stage2/sys/smp.h
rename to stages/sys/smp.h
diff --git a/stage2/sys/smp_trampoline.asm b/stages/sys/smp_trampoline.asm
similarity index 100%
rename from stage2/sys/smp_trampoline.asm
rename to stages/sys/smp_trampoline.asm
diff --git a/stage2/tinf b/stages/tinf
similarity index 100%
rename from stage2/tinf
rename to stages/tinf
diff --git a/test/limine.cfg b/test/limine.cfg
index 93019355..4fefa794 100644
--- a/test/limine.cfg
+++ b/test/limine.cfg
@@ -5,7 +5,7 @@ GRAPHICS=yes
 MENU_RESOLUTION=1024x768
 MENU_FONT=boot:///boot/font.bin
 E9_OUTPUT=yes
-STAGE2_MAP=boot:///boot/stage2.map
+STAGE2_MAP=boot:///boot/stages.map
 
 THEME_COLOURS=60000000;aa0000;00aaff;aa5500;0000aa;aa00aa;9076de;aaaaaa
 THEME_MARGIN=64
@@ -68,4 +68,4 @@ KERNEL_PATH=bios://:1/boot/test.elf
 KERNEL_CMDLINE=Woah! Another example!
 
 MODULE_PATH=bios://:1/boot/bg.bmp
-MODULE_STRING=yooooo
\ No newline at end of file
+MODULE_STRING=yooooo
tab: 248 wrap: offon