Finished Part I, moved part 2 relavent files to own folder.
This commit is contained in:
22
Part2/A4/08_shell/kernel/kernel.c
Executable file
22
Part2/A4/08_shell/kernel/kernel.c
Executable file
@@ -0,0 +1,22 @@
|
||||
#include "../cpu/isr.h"
|
||||
#include "../drivers/screen.h"
|
||||
#include "kernel.h"
|
||||
#include "../libc/string.h"
|
||||
|
||||
void _start() {
|
||||
isr_install();
|
||||
irq_install();
|
||||
|
||||
kprint("Type something, it will go through the kernel\n"
|
||||
"Type END to halt the CPU\n> ");
|
||||
}
|
||||
|
||||
void user_input(char *input) {
|
||||
if (strcmp(input, "END") == 0) {
|
||||
kprint("Stopping the CPU. Bye!\n");
|
||||
asm volatile("hlt");
|
||||
}
|
||||
kprint("You said: ");
|
||||
kprint(input);
|
||||
kprint("\n> ");
|
||||
}
|
6
Part2/A4/08_shell/kernel/kernel.h
Executable file
6
Part2/A4/08_shell/kernel/kernel.h
Executable file
@@ -0,0 +1,6 @@
|
||||
#ifndef KERNEL_H
|
||||
#define KERNEL_H
|
||||
|
||||
void user_input(char *input);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user