i mean, its not triple faulting anymore
This commit is contained in:
parent
f4cfc6f64b
commit
0e903f912c
30
shell.c
30
shell.c
@ -4,26 +4,28 @@
|
||||
#include "pit.h"
|
||||
|
||||
char line[LINE_LENGTH];
|
||||
|
||||
void jmain(void) {
|
||||
memset((u8*)line, 0x00, LINE_LENGTH);
|
||||
printf("Welcome to jankos\n");
|
||||
printf("Some basic commands to get you started: \n"
|
||||
" timer: prints out current timer tick\n"
|
||||
" quit: hangs because power management vry hrd\n");
|
||||
printf("Where's the prompt? \n It literally causes triple faults so its invisible :^)\n"
|
||||
"_Also the cursor is busted and i don't wanna fix it");
|
||||
while(1) {
|
||||
printf("jos % ");
|
||||
memset((u8*)line, 0x00, LINE_LENGTH);
|
||||
read(line, LINE_LENGTH);
|
||||
printf("\n");
|
||||
//asm("xchg bx, bx");
|
||||
if(!strcmp("break", line)) {
|
||||
printf("breaking out");
|
||||
memset((u8*)line, 0x00, LINE_LENGTH);
|
||||
if(strlen(line) == 1) {
|
||||
continue;
|
||||
}
|
||||
else if(!strcmp("timer", line)) {
|
||||
if(!strcmp("quit\n", line)) {
|
||||
printf("Well I guess we'll hang now\n");
|
||||
break;
|
||||
}
|
||||
if(!strcmp("timer\n", line)) {
|
||||
printf("Time tick: ");
|
||||
printhex(pit_timer_ticks);
|
||||
memset((u8*)line, 0x00, LINE_LENGTH);
|
||||
}
|
||||
else {
|
||||
printf("Attempting a second read: ");
|
||||
read(line, LINE_LENGTH);
|
||||
printf(line);
|
||||
printhex(pit_timer_ticks); putch('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
stlio.c
2
stlio.c
@ -64,6 +64,7 @@ u32 read(char* buffer, u32 size) {
|
||||
if(pit_timer_ticks - kbd_time < 0x20 && state == KBD_RELEASE) {
|
||||
__char_set(&(buffer[bytes]), (u8)kbd_key);
|
||||
if(kbd_key == '\n') {
|
||||
putch('\n');
|
||||
return bytes;
|
||||
}
|
||||
bytes++;
|
||||
@ -72,6 +73,7 @@ u32 read(char* buffer, u32 size) {
|
||||
}
|
||||
pit_timer_wait(1);
|
||||
}
|
||||
kbd_key = KBD_RELEASE;
|
||||
buffer[size-1] = '\0';
|
||||
return bytes;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user