Mon 9 Dec 20:40:44 CET 2024
This commit is contained in:
parent
57ef0f68ee
commit
7f09f23871
|
@ -3,7 +3,7 @@ Copyright (C) 2015-2019 The University of Notre Dame
|
||||||
This software is distributed under the GNU General Public License.
|
This software is distributed under the GNU General Public License.
|
||||||
See the file LICENSE for details.
|
See the file LICENSE for details.
|
||||||
*/
|
*/
|
||||||
|
#include "kernel/config.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
|
@ -38,7 +38,7 @@ int kernel_main()
|
||||||
{
|
{
|
||||||
struct console *console = console_create_root();
|
struct console *console = console_create_root();
|
||||||
console_addref(console);
|
console_addref(console);
|
||||||
|
printf("Basekernel Version %d.%d %s\n",KERNEL_MAJOR,KERNEL_MINOR,__DATE__);
|
||||||
printf("video: %d x %d (addr %x)\n", video_xres, video_yres, video_buffer);
|
printf("video: %d x %d (addr %x)\n", video_xres, video_yres, video_buffer);
|
||||||
printf("kernel: %d bytes\n", kernel_size);
|
printf("kernel: %d bytes\n", kernel_size);
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ int kernel_main()
|
||||||
interrupt_init();
|
interrupt_init();
|
||||||
mouse_init();
|
mouse_init();
|
||||||
keyboard_init();
|
keyboard_init();
|
||||||
|
serial_init();
|
||||||
rtc_init();
|
rtc_init();
|
||||||
clock_init();
|
clock_init();
|
||||||
process_init();
|
process_init();
|
||||||
|
@ -61,12 +62,41 @@ int kernel_main()
|
||||||
current->ktable[KNO_STDDIR] = 0; // No current dir until something is mounted.
|
current->ktable[KNO_STDDIR] = 0; // No current dir until something is mounted.
|
||||||
|
|
||||||
|
|
||||||
printf("\n");
|
printf("kernel initialization is done.\n");
|
||||||
|
#define KSHELL_SERIAL
|
||||||
|
#ifndef KSHELL_SERIAL
|
||||||
kshell_launch();
|
kshell_launch();
|
||||||
|
// never reached!
|
||||||
|
#else
|
||||||
|
// main IO loop, from kshell_launch
|
||||||
|
char line[100];
|
||||||
|
int lineIndex=0;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
console_putchar(console,console_getchar(console));
|
// console_putchar(console,console_getchar(console));
|
||||||
}
|
char c;
|
||||||
|
while ((c = serial_read_nonblock(0))<0) clock_wait(10);
|
||||||
|
console_putchar(console,c);
|
||||||
|
if (c=='\n') { // End of line
|
||||||
|
const char *argv[100];
|
||||||
|
int argc;
|
||||||
|
argc = 0;
|
||||||
|
line[lineIndex]=0;
|
||||||
|
argv[argc] = strtok(line, " ");
|
||||||
|
|
||||||
|
// split line in tokens separated by spaces
|
||||||
|
while(argv[argc]) {
|
||||||
|
argc++;
|
||||||
|
argv[argc] = strtok(0, " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(argc > 0) {
|
||||||
|
kshell_execute(argc, argv);
|
||||||
|
}
|
||||||
|
lineIndex=0;
|
||||||
|
} else line[lineIndex++]=c; // collect char
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// never reached
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user