|
tape-kernel 1.0
a modular modern independent kernel
|
#include "../usr/shell.h"#include "../io/vga.h"#include "../io/cm.h"#include "../lib/utils.h"#include "../mem/heap.h"#include "../fs/ide.h"#include "../fs/ffs.h"#include "../fs/fs.h"#include "../lib/err.h"#include "../io/io.h"#include "../lib/pit.h"#include "../mem/mem.h"
Go to the source code of this file.
Macros | |
| #define | KHEAP_SIZE (1024 * 1024) |
| #define | FS_ARENA_SIZE (256 * 1024) |
| #define | CMD_ARENA_SIZE (128 * 1024) |
Functions | |
| void | ___init (void) |
| ___init initializes all kernel subsystems | |
| void * | malloc (uint32_t size) |
| malloc is a gdb friendly wrapper around alc | |
| void | ___kmain (uint32_t magic, void *mb_info) |
| ___kmain is the main kernel entry point after boot | |
Variables | |
| static uint8_t | kmem [(1024 *1024)] |
| description of heap sizes in src/kernel/main.c | |
| arena_t | kheap |
| arena_t * | fs_arena |
| the filesystem child arena | |
| arena_t * | cmd_arena |
| the command processing child arena | |
| static int | ___init_called = 0 |
| void ___init | ( | void | ) |
___init initializes all kernel subsystems
___init is a function that sets up the kernel heap, child arenas, pit timer, ide disk controller, flat filesystem, and filesystem tooling, then runs a full sanity check suite before returning
___init is called once at boot time and will panic if called twice
using ___init is done with
Definition at line 86 of file main.c.
References ___init_called, alc, anew, assert, clscr, cmd_arena, CMD_ARENA_SIZE, cnb, cob, ffsinit, fs_arena, FS_ARENA_SIZE, fsdelete, fsfind, fsinit, fsread, fswrite, hcur, hinit, ideinit, inb, irsec, iwrt, kheap, kmem, NULL, panic, pinit, prt, scur, and strcmp().
Referenced by ___kmain().
| void ___kmain | ( | uint32_t | magic, |
| void * | mb_info ) |
___kmain is the main kernel entry point after boot
___kmain is a function called by the multiboot bootloader that verifies the multiboot magic, runs kernel initialization, and enters the infinite interactive shell loop
| magic,the | multiboot magic number (should be 0x2BADB002) |
| mb_info,a | pointer to the multiboot information structure |
using ___kmain is done with
| void * malloc | ( | uint32_t | size | ) |
malloc is a gdb friendly wrapper around alc
malloc is a function that allocates memory from the main kernel heap, it exists primarily for gdb compatibility
| size,the | number of bytes to allocate |
| arena_t* cmd_arena |
| arena_t* fs_arena |
the filesystem child arena
fs_arena is a 256kb arena allocated from kheap and used for filesystem operations like storing filenames and file data
Definition at line 56 of file main.c.
Referenced by ___init(), cmd_writefile(), and editor_save().
|
static |
description of heap sizes in src/kernel/main.c
there are 3 heaps in the kernel, kheap (kernel heap) with childs of fs_arena (filesystem arena) and cmd_arena (command arena) kheap is 1mb total fs_arena is 256kb from kheap cmd_arena is 128kb from kheap
this leaves 640kb~ of space in kheap
the main kernel heap
kheap is the primary 1mb arena that all kernel allocations come from, child arenas are carved out of this heap
Definition at line 45 of file main.c.
Referenced by ___init().