|
tape-kernel 1.0
a modular modern independent kernel
|
#include "shell.h"#include "../fs/ide.h"#include "../mem/mem.h"#include "../fs/fs.h"#include "../io/vga.h"#include "../io/cm.h"#include "../lib/err.h"#include "../lib/utils.h"#include "../mem/heap.h"#include "editor.h"#include "../fs/ffs.h"#include "../kernel/cpu.h"#include "../io/io.h"
Go to the source code of this file.
Functions | |
| static void | show_help (void) |
| displays shell help | |
| static void | cmd_writefile (const char *name, const char *msg) |
| cmd_writefile writes a text message to a new file | |
| static void | cmd_readfile (const char *name) |
| cmd_readfile reads and displays a files contents | |
| static void | cmd_alloc (uint32_t size) |
| cmd_alloc allocates memory from the command arena | |
| void | __shell (void *mb_info) |
| shell is the interactive kernel command shell | |
Variables | |
| arena_t * | cmd_arena |
| the command processing child arena | |
| arena_t * | fs_arena |
| the filesystem child arena | |
| void __shell | ( | void * | mb_info | ) |
shell is the interactive kernel command shell
shell is a function that runs an infinite loop displaying the tape prompt and processing user commands
| mb_info,the | multiboot info pointer passed from kmain for memory queries |
shell supports the following commands: help, clear, ls, read, write, rm, echo, reboot, alloc, heap, panic, and info
using shell is done with
Definition at line 182 of file shell.c.
References atoi(), clscr, cmd_alloc(), cmd_arena, cmd_readfile(), cmd_writefile(), cnb, cob, disksize, editor, fsdelete, fsfind, fslist, getcpu, lines, MAX_ARGS, memsize, NORETURN, panic, pargs(), prt, prtd, prth, rdln, reboot, res, scrl, show_help(), strcmp(), and strlen().
|
static |
cmd_alloc allocates memory from the command arena
cmd_alloc is a static function that allocates a block of memory from cmd_arena and prints the resulting pointer address
| size,the | number of bytes to allocate (defaults to 100) |
Definition at line 145 of file shell.c.
References alc, cmd_arena, cnb, cob, prt, prtd, and prth.
Referenced by __shell().
|
static |
cmd_readfile reads and displays a files contents
cmd_readfile is a static function that looks up a file on disk by name and prints its contents to the screen
| name,the | name of the file to read |
Definition at line 97 of file shell.c.
References cnb, cob, fsfind, irsec, lines, and prt.
Referenced by __shell().
|
static |
cmd_writefile writes a text message to a new file
cmd_writefile is a static function that creates a new file with a given name and fills it with the provided text content
| name,the | name of the file to create |
| msg,the | text content to write |
Definition at line 68 of file shell.c.
References cnb, cob, fs_arena, fsadd, fsnextlba, iwrt, and prt.
Referenced by __shell().
|
static |
displays shell help
the show_help() internal function of shell.c displays kernel help adding help should be done with:
please use variable naming convention of '[param]' for ints and '' for strings
Definition at line 38 of file shell.c.
References clscr, cob, and prt.
Referenced by __shell().
|
extern |
|
extern |
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().