inlined a version of putch for better cache locality
This commit is contained in:
parent
9f793bfd2a
commit
ee7e44fbaf
15
stlio.c
15
stlio.c
@ -50,6 +50,15 @@ static void __char_set(u8* dest, u8 desire) {
|
|||||||
*dest = desire;
|
*dest = desire;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void __put_ch(const char c) {
|
||||||
|
if(c == '\n') {
|
||||||
|
frame_buffer_newline();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
write_char(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
u32 read(char* buffer, u32 size) {
|
u32 read(char* buffer, u32 size) {
|
||||||
// try the timing thing again after this
|
// try the timing thing again after this
|
||||||
u32 bytes = 0;
|
u32 bytes = 0;
|
||||||
@ -64,12 +73,12 @@ 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');
|
__put_ch('\n');
|
||||||
return bytes;
|
return ++bytes;
|
||||||
}
|
}
|
||||||
bytes++;
|
bytes++;
|
||||||
__char_set(&kbd_state, KBD_WAITING); // reset the kbd_state since we've now used it
|
__char_set(&kbd_state, KBD_WAITING); // reset the kbd_state since we've now used it
|
||||||
putch(kbd_key);
|
__put_ch(kbd_key);
|
||||||
}
|
}
|
||||||
pit_timer_wait(1);
|
pit_timer_wait(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user