mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2024-10-27 20:34:19 +00:00
Use an array instead of an uninitialized wild pointer.
Using wild pointers is a dangerous practice, although you may not encounter errors now.
This commit is contained in:
parent
7aff64740e
commit
bd527d3572
@ -6,7 +6,7 @@
|
|||||||
static void keyboard_callback(registers_t regs) {
|
static void keyboard_callback(registers_t regs) {
|
||||||
/* The PIC leaves us the scancode in port 0x60 */
|
/* The PIC leaves us the scancode in port 0x60 */
|
||||||
u8 scancode = port_byte_in(0x60);
|
u8 scancode = port_byte_in(0x60);
|
||||||
char *sc_ascii;
|
char sc_ascii[4];
|
||||||
int_to_ascii(scancode, sc_ascii);
|
int_to_ascii(scancode, sc_ascii);
|
||||||
kprint("Keyboard scancode: ");
|
kprint("Keyboard scancode: ");
|
||||||
kprint(sc_ascii);
|
kprint(sc_ascii);
|
||||||
@ -99,24 +99,24 @@ void print_letter(u8 scancode) {
|
|||||||
case 0x19:
|
case 0x19:
|
||||||
kprint("P");
|
kprint("P");
|
||||||
break;
|
break;
|
||||||
case 0x1A:
|
case 0x1A:
|
||||||
kprint("[");
|
kprint("[");
|
||||||
break;
|
break;
|
||||||
case 0x1B:
|
case 0x1B:
|
||||||
kprint("]");
|
kprint("]");
|
||||||
break;
|
break;
|
||||||
case 0x1C:
|
case 0x1C:
|
||||||
kprint("ENTER");
|
kprint("ENTER");
|
||||||
break;
|
break;
|
||||||
case 0x1D:
|
case 0x1D:
|
||||||
kprint("LCtrl");
|
kprint("LCtrl");
|
||||||
break;
|
break;
|
||||||
case 0x1E:
|
case 0x1E:
|
||||||
kprint("A");
|
kprint("A");
|
||||||
break;
|
break;
|
||||||
case 0x1F:
|
case 0x1F:
|
||||||
kprint("S");
|
kprint("S");
|
||||||
break;
|
break;
|
||||||
case 0x20:
|
case 0x20:
|
||||||
kprint("D");
|
kprint("D");
|
||||||
break;
|
break;
|
||||||
@ -147,24 +147,24 @@ void print_letter(u8 scancode) {
|
|||||||
case 0x29:
|
case 0x29:
|
||||||
kprint("`");
|
kprint("`");
|
||||||
break;
|
break;
|
||||||
case 0x2A:
|
case 0x2A:
|
||||||
kprint("LShift");
|
kprint("LShift");
|
||||||
break;
|
break;
|
||||||
case 0x2B:
|
case 0x2B:
|
||||||
kprint("\\");
|
kprint("\\");
|
||||||
break;
|
break;
|
||||||
case 0x2C:
|
case 0x2C:
|
||||||
kprint("Z");
|
kprint("Z");
|
||||||
break;
|
break;
|
||||||
case 0x2D:
|
case 0x2D:
|
||||||
kprint("X");
|
kprint("X");
|
||||||
break;
|
break;
|
||||||
case 0x2E:
|
case 0x2E:
|
||||||
kprint("C");
|
kprint("C");
|
||||||
break;
|
break;
|
||||||
case 0x2F:
|
case 0x2F:
|
||||||
kprint("V");
|
kprint("V");
|
||||||
break;
|
break;
|
||||||
case 0x30:
|
case 0x30:
|
||||||
kprint("B");
|
kprint("B");
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user