Skip to content

Commit

Permalink
- | Deleting some stuff in the filesystem, want to build IDE driver f…
Browse files Browse the repository at this point in the history
…irst
  • Loading branch information
BolvicBolvicovic committed Sep 18, 2024
1 parent 58acabd commit 162a895
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 25 deletions.
6 changes: 3 additions & 3 deletions filesystem/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ MEM = filesystem.a
VFS_SRC = vfs/vfs.c
VFS_OBJ = vfs/vfs.o

IRD_SRC = initrd/initrd.c
IRD_OBJ = initrd/initrd.o
#IRD_SRC = initrd/initrd.c
#IRD_OBJ = initrd/initrd.o

AR = ../gcc_kfs/bin/i386-elf-ar rcs
CC = ../gcc_kfs/bin/i386-elf-gcc
Expand All @@ -16,7 +16,7 @@ FLAGS = -ffreestanding \

all: $(MEM)

$(MEM): $(VFS_OBJ) $(IRD_OBJ)
$(MEM): $(VFS_OBJ) #$(IRD_OBJ)
$(AR) $@ $^

vfs/%.o: vfs/%.c
Expand Down
2 changes: 1 addition & 1 deletion filesystem/vfs/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ uint32_t fs_close(PFILE node) {
}

dentry* fs_readdir(PFILE node, uint32_t index) {
if ((node->type & FS_DIR) && node->node_operations.readdir) return node->readdir(node, index);
if ((node->type & FS_DIR) && node->node_operations.readdir) return node->node_operations.readdir(node, index);
return NULL;
}
16 changes: 8 additions & 8 deletions filesystem/vfs/vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "../../lib/string/string.h"
#include "../../memory/vmm/vmm.h"

typedef enum node_type {
enum node_type {
FS_FILE,
FS_DIR,
FS_CHARDEVICE,
Expand All @@ -16,7 +16,7 @@ typedef enum node_type {
FS_MOUNTPOINT
};

typedef enum open_flags {
enum open_flags {
READ,
WRITE
};
Expand All @@ -35,12 +35,12 @@ typedef struct _FILE {
uint32_t inode;
uint32_t length;
struct node_operations {
uint32_t (*read)(struct FILE*,uint32_t,uint32_t,char*buffer);
uint32_t (*write)(struct FILE*,uint32_t,uint32_t,char*buffer);
uint32_t (*open)(struct FILE*, enum open_flags);
uint32_t (*close)(struct FILE*);
dentry* (*readdir)(struct FILE*,uint32_t);
};
uint32_t (*read)(struct _FILE*,uint32_t,uint32_t,char*buffer);
uint32_t (*write)(struct _FILE*,uint32_t,uint32_t,char*buffer);
uint32_t (*open)(struct _FILE*, enum open_flags);
uint32_t (*close)(struct _FILE*);
dentry* (*readdir)(struct _FILE*,uint32_t);
} node_operations;
} FILE, *PFILE;

uint32_t fs_close(PFILE);
Expand Down
1 change: 0 additions & 1 deletion isoroot/boot/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ set default=0

menuentry "KFS" {
multiboot /boot/kfs.elf
module /boot/initrd.img
boot
}
Binary file removed isoroot/boot/initrd.img
Binary file not shown.
6 changes: 4 additions & 2 deletions kernel/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ void kernel_main(uint32_t magic, uint32_t addr) {
multiboot_info_t* mbi = (multiboot_info_t*)addr;
struct multiboot_mmap_entry* region = (struct multiboot_mmap_entry*) mbi->mmap_addr;
uint32_t mem_size = MAX_MEMORY_SIZE;
// uint32_t initrd_location = *(uint32_t*)(mbi->mods_addr);
// uint32_t initrd_end = *(uint32_t*)(mbi->mods_addr + 4);
uint32_t initrd_location = *(uint32_t*)(mbi->mods_addr);
uint32_t initrd_end = *(uint32_t*)(mbi->mods_addr + 4);

init_current_screen(BLUE, WHITE);
term_clear();
Expand All @@ -54,6 +54,8 @@ void kernel_main(uint32_t magic, uint32_t addr) {
asm volatile("mov %%cr0, %0" : "=r" (cr0));
if (cr0 & 0x80000000) printf("Paging enabled: cr0 == %p\n", cr0);
else printf("Paging disabled: cr0 == %p\n", cr0);
printf("addr: %p value: %d\n", initrd_location, *(uint32_t*)initrd_location);
printf("addr: %p value: %d\n", initrd_end, *(uint32_t*)initrd_end);
// if (!mbi->mods_count) printf("no mods added\n");
// fs_root = initialise_initrd(initrd_location);
}
2 changes: 1 addition & 1 deletion kernel/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#include "../multiboot/multiboot.h"
#include "../memory/pmm/pmm.h"
#include "../memory/vmm/vmm.h"
#include "../filesystem/initrd/initrd.h"
#include "../filesystem/ext2/fs.h"
#endif
9 changes: 0 additions & 9 deletions make_initrd.sh

This file was deleted.

0 comments on commit 162a895

Please sign in to comment.