diff options
author | Marvin Borner | 2020-04-21 00:37:02 +0200 |
---|---|---|
committer | Marvin Borner | 2020-04-21 00:45:47 +0200 |
commit | c83104329214bd618444d6e0242bb0317f52dbbc (patch) | |
tree | 8f884d12483f21e94ace5b60d353ad9c8fc14a7c | |
parent | 62b27d5307b1ac019a0a3a27fe947cccff8875f6 (diff) |
Finally! EXT2 is working now :)
Puuh.
-rw-r--r-- | .github/workflows/build.yml | 2 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rwxr-xr-x | run | 14 | ||||
-rw-r--r-- | src/kernel/fs/ext2.c | 5 | ||||
-rw-r--r-- | src/kernel/fs/load.c | 2 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.c | 10 | ||||
-rw-r--r-- | src/kernel/io/io.c | 12 | ||||
-rw-r--r-- | src/kernel/kernel.c | 1 | ||||
-rw-r--r-- | src/kernel/memory/paging.c | 2 |
9 files changed, 25 insertions, 24 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc54a2d..74954a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Install - run: sudo apt-get update && sudo apt-get install -y build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libcloog-isl-dev libisl-0.18-dev ccache curl nasm grub qemu qemu-kvm mtools genext2fs + run: sudo apt-get update && sudo apt-get install -y build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libcloog-isl-dev libisl-0.18-dev ccache curl nasm grub* qemu qemu-kvm mtools - name: Get cross compiler id: cache-cross uses: actions/cache@v1 @@ -29,7 +29,6 @@ * nasm * qemu * grub - * genext2fs * Build a cross compiler using `./run cross` @@ -88,12 +88,12 @@ make_build() { stripped=$(echo "${line}" | sed -r 's/\//_/g') stripped=${stripped#??????} stripped=${stripped%%?}o - compile_with_flags -O2 -s -c ./"${line}" -I ./src -D ${network} -o ./build/kernel/"${stripped}" + compile_with_flags -s -c ./"${line}" -I ./src -D ${network} -o ./build/kernel/"${stripped}" done <./build/tmp rm ./build/tmp # Link kernel ASM and C objects - compile_with_flags -O2 -s ./build/kernel/*.o -T ./src/kernel/linker.ld -I ./src -o ./build/melvix.bin + compile_with_flags -s ./build/kernel/*.o -T ./src/kernel/linker.ld -I ./src -o ./build/melvix.bin # Modules # TODO: Find out why no font optimizations cause strange glitches @@ -121,9 +121,13 @@ make_build() { cp ./build/font.bin ./iso/font.bin grub-mkrescue -o ./build/melvix.iso ./iso/ || exit 1 - mkdir ./mnt/ - echo "Bananenkuchen" >./mnt/test - genext2fs -d ./mnt/ -U -N 4096 -b 65536 ./build/disk.img || exit 1 + mke2fs -b 4096 -N 4096 ./build/disk.img 65536 || exit 1 + mkdir ./mnt/ || exit 1 + sudo mount ./build/disk.img ./mnt/ || exit 1 + sudo mkdir -p ./mnt/abc/def/ + echo "Bananenkuchen" | sudo tee -a ./mnt/test + echo "toll" | sudo tee -a ./mnt/abc/def/baum + sync && sudo umount mnt || exit 1 rm -r mnt/ printf "Build finshed successfully!\n\n" diff --git a/src/kernel/fs/ext2.c b/src/kernel/fs/ext2.c index 7ce0601..c95c134 100644 --- a/src/kernel/fs/ext2.c +++ b/src/kernel/fs/ext2.c @@ -36,7 +36,7 @@ void ext2_init_fs() struct ext2_dirent dirent; while (ext2_next_dirent(&file, &dirent)) - log("Inode %d, name `%s'", dirent.inode_num, dirent.name); + log("Inode %d, name '%s'", dirent.inode_num, dirent.name); kfree(file.buf); @@ -46,7 +46,6 @@ void ext2_init_fs() log("File not found"); else log("Found: inode = %d", inode); - panic("nice"); } static void read_block(uint32_t block_num, void *buf) @@ -70,7 +69,7 @@ static void load_superblock() assert(superblock.signature == EXT2_SIGNATURE); log("Total inodes = 0x%x", superblock.total_inodes); log("Total blocks = 0x%x", superblock.total_blocks); - log("Block size = %b", block_size); + log("Block size = %d", block_size); log("Num blocks = %d", superblock.total_blocks); log("Blocks/group = %d", superblock.blocks_per_group); log("Inodes/group = %d", superblock.inodes_per_group); diff --git a/src/kernel/fs/load.c b/src/kernel/fs/load.c index 7f5340a..9aca1c3 100644 --- a/src/kernel/fs/load.c +++ b/src/kernel/fs/load.c @@ -31,5 +31,5 @@ void load_binaries() halt_loop(); } }*/ - vga_log("Successfully loaded binaries"); + log("Successfully loaded binaries"); }
\ No newline at end of file diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c index 926c34a..853c503 100644 --- a/src/kernel/graphics/vesa.c +++ b/src/kernel/graphics/vesa.c @@ -104,8 +104,8 @@ struct vbe_mode_info *vbe_get_mode_info(uint16_t mode) void set_optimal_resolution() { - vga_log("Switching to graphics mode"); - vga_log("Trying to detect available modes"); + log("Switching to graphics mode"); + log("Trying to detect available modes"); uint16_t *video_modes = vbe_get_modes(); uint16_t highest = 0; @@ -135,8 +135,8 @@ void set_optimal_resolution() kfree(video_modes); if (highest == 0) { - vga_log("Mode detection failed!"); - vga_log("Trying common modes..."); + log("Mode detection failed!"); + log("Trying common modes..."); struct vbe_mode_info *mode_info; int modes[] = { 322, 287, 286, 285, 284, // 1600x1200 @@ -177,7 +177,7 @@ void set_optimal_resolution() if (highest == 0) switch_to_vga(); } else { - vga_log("Mode detection succeeded"); + log("Mode detection succeeded"); } vbe_set_mode(highest); diff --git a/src/kernel/io/io.c b/src/kernel/io/io.c index 803a78a..cd03408 100644 --- a/src/kernel/io/io.c +++ b/src/kernel/io/io.c @@ -4,21 +4,21 @@ uint8_t inb(uint16_t port) { uint8_t value; - asm("inb %1, %0" : "=a"(value) : "Nd"(port)); + asm volatile("inb %1, %0" : "=a"(value) : "Nd"(port)); return value; } uint16_t inw(uint16_t port) { uint16_t value; - asm("inw %1, %0" : "=a"(value) : "Nd"(port)); + asm volatile("inw %1, %0" : "=a"(value) : "Nd"(port)); return value; } uint32_t inl(uint16_t port) { uint32_t value; - asm("inl %1, %0" : "=a"(value) : "Nd"(port)); + asm volatile("inl %1, %0" : "=a"(value) : "Nd"(port)); return value; } @@ -39,17 +39,17 @@ void hlt() void outb(uint16_t port, uint8_t data) { - asm("outb %0, %1" ::"a"(data), "Nd"(port)); + asm volatile("outb %0, %1" ::"a"(data), "Nd"(port)); } void outw(uint16_t port, uint16_t data) { - asm("outw %0, %1" ::"a"(data), "Nd"(port)); + asm volatile("outw %0, %1" ::"a"(data), "Nd"(port)); } void outl(uint16_t port, uint32_t data) { - asm("outl %0, %1" ::"a"(data), "Nd"(port)); + asm volatile("outl %0, %1" ::"a"(data), "Nd"(port)); } void init_serial() diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index 84ed953..57b853f 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -57,7 +57,6 @@ void kernel_main(uint32_t magic, uint32_t multiboot_address) ata_init(); ext2_init_fs(); - panic("YAY"); load_binaries(); set_optimal_resolution(); diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c index 99160d0..d859efc 100644 --- a/src/kernel/memory/paging.c +++ b/src/kernel/memory/paging.c @@ -78,7 +78,7 @@ void paging_switch_directory(int user) asm("mov %0, %%cr3" ::"r"(current_page_directory)); } -inline void invlpg(uint32_t addr) +void invlpg(uint32_t addr) { asm("invlpg (%0)" ::"r"(addr) : "memory"); } |