[vfs] Fix some things

This commit is contained in:
Kevin Lange 2011-01-22 01:38:25 -06:00
parent f6c73d0229
commit 2809921449
4 changed files with 19 additions and 5 deletions

View File

@ -8,6 +8,13 @@
extern uintptr_t end;
uintptr_t placement_pointer = &end;
void
kmalloc_startat(
uintptr_t address
) {
placement_pointer = address;
}
/*
* kmalloc() is the kernel's dumb placement allocator
*/

View File

@ -9,6 +9,8 @@
#define FS_SYMLINK 0x06
#define FS_MOUNTPOINT 0x08
struct fs_node;
typedef uint32_t (*read_type_t)(struct fs_node*, uint32_t, uint32_t, uint8_t *);
typedef uint32_t (*write_type_t)(struct fs_node*, uint32_t, uint32_t, uint8_t *);
typedef void (*open_type_t)(struct fs_node*, uint8_t read, uint8_t write);
@ -16,11 +18,6 @@ typedef void (*close_type_t)(struct fs_node*);
typedef struct dirent * (*readdir_type_t)(struct fs_node*, uint32_t);
typedef struct fs_node * (*finddir_type_t)(struct fs_node*, char *name);
struct dirent {
char name[256];
uint32_t ino;
};
typedef struct fs_node {
char name[256];
uint32_t mask;
@ -39,6 +36,12 @@ typedef struct fs_node {
struct fs_node *ptr;
} fs_node_t;
struct dirent {
char name[256];
uint32_t ino;
};
extern fs_node_t *fs_root;
uint32_t read_fs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer);

View File

@ -86,6 +86,7 @@ extern void kprintf(const char *fmt, ...);
/* Memory Management */
extern uintptr_t placement_pointer;
extern void kmalloc_startat(uintptr_t address);
extern uintptr_t kmalloc_real(size_t size, int align, uintptr_t * phys);
extern uintptr_t kmalloc(size_t size);
extern uintptr_t kvmalloc(size_t size);

3
main.c
View File

@ -151,6 +151,9 @@ dump_multiboot(
*/
int
main(struct multiboot *mboot_ptr) {
if (mboot_ptr->mods_count > 0) {
kmalloc_startat(((uintptr_t *)mboot_ptr->mods_addr)[1]);
}
mboot_ptr = copy_multiboot(mboot_ptr);
gdt_install(); /* Global descriptor table */