MonkOS  v0.1
A simple 64-bit operating system (x86_64)
shell.c File Reference

Simple kernel shell for testing purposes. More...

#include <core.h>
#include <libc/stdio.h>
#include <libc/stdlib.h>
#include <libc/string.h>
#include <kernel/device/pci.h>
#include <kernel/device/tty.h>
#include <kernel/device/keyboard.h>
#include <kernel/mem/acpi.h>
#include <kernel/mem/heap.h>
#include <kernel/mem/paging.h>
#include <kernel/x86/cpu.h>

Go to the source code of this file.

Data Structures

struct  mode_t
 Shell mode descriptor. More...
 
struct  cmd
 A command descriptor, describing each command accepted in command mode. More...
 

Macros

#define TTY_CONSOLE   0
 

Functions

static void command_prompt ()
 
static void command_run ()
 
static void keycode_run ()
 
static bool cmd_display_help ()
 
static bool cmd_display_apic ()
 
static bool cmd_display_pci ()
 
static bool cmd_display_pcie ()
 
static bool cmd_switch_to_keycodes ()
 
static bool cmd_test_heap ()
 
static void switch_mode (mode_t *mode)
 
static int cmp_cmds (const void *c1, const void *c2)
 
static bool command_exec (const char *cmd)
 
void kshell ()
 

Variables

static mode_t mode_command
 
static mode_t mode_keycode
 
static mode_tactive_mode
 
static struct cmd commands []
 

Detailed Description

Simple kernel shell for testing purposes.

Definition in file shell.c.

Macro Definition Documentation

Function Documentation

static void command_prompt ( )
static

Definition at line 221 of file shell.c.

Referenced by command_run().

static void command_run ( )
static

Definition at line 227 of file shell.c.

static void keycode_run ( )
static

Definition at line 279 of file shell.c.

static bool cmd_display_help ( )
static

Definition at line 100 of file shell.c.

static bool cmd_display_apic ( )
static

Definition at line 113 of file shell.c.

static bool cmd_display_pci ( )
static

Definition at line 150 of file shell.c.

static bool cmd_display_pcie ( )
static

Definition at line 157 of file shell.c.

static bool cmd_switch_to_keycodes ( )
static

Definition at line 176 of file shell.c.

static bool cmd_test_heap ( )
static

Definition at line 185 of file shell.c.

static void switch_mode ( mode_t mode)
static

Definition at line 62 of file shell.c.

Referenced by cmd_switch_to_keycodes(), and keycode_run().

static int cmp_cmds ( const void *  c1,
const void *  c2 
)
static

Definition at line 93 of file shell.c.

Referenced by kshell().

static bool command_exec ( const char *  cmd)
static

Definition at line 206 of file shell.c.

Referenced by command_run().

void kshell ( )

Definition at line 314 of file shell.c.

Referenced by kmain().

Variable Documentation

mode_t mode_command
static
Initial value:
=
{
NULL
}
static void command_run()
Definition: shell.c:227
static void command_prompt()
Definition: shell.c:221

Definition at line 44 of file shell.c.

Referenced by kshell().

mode_t mode_keycode
static
Initial value:
=
{
NULL,
NULL
}
static void keycode_run()
Definition: shell.c:279

Definition at line 52 of file shell.c.

mode_t* active_mode
static

Definition at line 59 of file shell.c.

struct cmd commands[]
static
Initial value:
=
{
{ "?", NULL, cmd_display_help },
{ "help", "Show this help text", cmd_display_help },
{ "apic", "Show APIC configuration", cmd_display_apic },
{ "pci", "Show PCI devices", cmd_display_pci },
{ "pcie", "Show PCIexpress configuration", cmd_display_pcie },
{ "kc", "Switch to keycode display mode", cmd_switch_to_keycodes },
{ "heap", "Test heap allocation", cmd_test_heap },
}
static bool cmd_display_pcie()
Definition: shell.c:157
static bool cmd_display_apic()
Definition: shell.c:113
static bool cmd_test_heap()
Definition: shell.c:185
static bool cmd_display_help()
Definition: shell.c:100
static bool cmd_switch_to_keycodes()
Definition: shell.c:176
static bool cmd_display_pci()
Definition: shell.c:150

Definition at line 81 of file shell.c.