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"
|
#include "pit.h"
|
||||||
|
|
||||||
char line[LINE_LENGTH];
|
char line[LINE_LENGTH];
|
||||||
|
|
||||||
void jmain(void) {
|
void jmain(void) {
|
||||||
memset((u8*)line, 0x00, LINE_LENGTH);
|
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) {
|
while(1) {
|
||||||
printf("jos % ");
|
memset((u8*)line, 0x00, LINE_LENGTH);
|
||||||
read(line, LINE_LENGTH);
|
read(line, LINE_LENGTH);
|
||||||
printf("\n");
|
if(strlen(line) == 1) {
|
||||||
//asm("xchg bx, bx");
|
continue;
|
||||||
if(!strcmp("break", line)) {
|
|
||||||
printf("breaking out");
|
|
||||||
memset((u8*)line, 0x00, LINE_LENGTH);
|
|
||||||
}
|
}
|
||||||
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: ");
|
printf("Time tick: ");
|
||||||
printhex(pit_timer_ticks);
|
printhex(pit_timer_ticks); putch('\n');
|
||||||
memset((u8*)line, 0x00, LINE_LENGTH);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("Attempting a second read: ");
|
|
||||||
read(line, LINE_LENGTH);
|
|
||||||
printf(line);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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) {
|
if(pit_timer_ticks - kbd_time < 0x20 && state == KBD_RELEASE) {
|
||||||
__char_set(&(buffer[bytes]), (u8)kbd_key);
|
__char_set(&(buffer[bytes]), (u8)kbd_key);
|
||||||
if(kbd_key == '\n') {
|
if(kbd_key == '\n') {
|
||||||
|
putch('\n');
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
bytes++;
|
bytes++;
|
||||||
@ -72,6 +73,7 @@ u32 read(char* buffer, u32 size) {
|
|||||||
}
|
}
|
||||||
pit_timer_wait(1);
|
pit_timer_wait(1);
|
||||||
}
|
}
|
||||||
|
kbd_key = KBD_RELEASE;
|
||||||
buffer[size-1] = '\0';
|
buffer[size-1] = '\0';
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user