Changeset 91 for trunk/hal/x86_64
- Timestamp:
- Jun 29, 2017, 11:02:22 AM (8 years ago)
- Location:
- trunk/hal/x86_64/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_cpu.S
r85 r91 56 56 ret 57 57 58 ASM_ENTRY(in8) 59 movq %rdi,%rdx 60 xorq %rax,%rax 61 inb %dx,%al 62 ret 63 58 64 ASM_ENTRY(out8) 59 65 movq %rdi,%rdx -
trunk/hal/x86_64/core/hal_internal.h
r83 r91 35 35 void sti(); 36 36 void cli(); 37 uint8_t in8(uint32_t port); 37 38 void out8(uint32_t port, uint8_t val); 38 39 uint64_t rdmsr(uint32_t); -
trunk/hal/x86_64/core/hal_trap.c
r89 r91 22 22 #include <hal_types.h> 23 23 #include <hal_kentry.h> 24 #include <hal_internal.h> 24 25 25 26 static const char *trap_type[] = { … … 82 83 } 83 84 85 /* -------------------------------------------------------------------------- */ 86 87 #define PS2_DATA 0x60 88 89 #define PS2_STATUS 0x64 90 # define STATUS_OUT_FULL 0x00 91 # define STATUS_IN_FULL 0x01 92 # define STATUS_SYS_FLAG 0x02 93 94 #define PS2_CMD 0x64 95 84 96 /* 85 * Keyboard interrupt 97 * US scancode table, found on the internet. 98 */ 99 unsigned char scancode_US[128] = 100 { 101 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 102 '\b', '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 103 '\n', 104 0, /* 29 - Control */ 105 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 106 0, /* Left shift */ 107 '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 108 0, /* Right shift */ 109 '*', 110 0, /* Alt */ 111 ' ', /* Space bar */ 112 0, /* Caps lock */ 113 0, /* 59 - F1 key ... > */ 114 0, 0, 0, 0, 0, 0, 0, 0, 115 0, /* < ... F10 */ 116 0, /* 69 - Num lock*/ 117 0, /* Scroll Lock */ 118 0, /* Home key */ 119 0, /* Up Arrow */ 120 0, /* Page Up */ 121 '-', 122 0, /* Left Arrow */ 123 0, 124 0, /* Right Arrow */ 125 '+', 126 0, /* 79 - End key*/ 127 0, /* Down Arrow */ 128 0, /* Page Down */ 129 0, /* Insert Key */ 130 0, /* Delete Key */ 131 0, 0, 0, 132 0, /* F11 Key */ 133 0, /* F12 Key */ 134 0, /* All other keys are undefined */ 135 }; 136 137 /* 138 * Keyboard interrupt (8042 PS/2) 86 139 */ 87 140 void hal_keyboard_intr(struct trapframe *tf) 88 141 { 89 x86_printf("-> got keyboard: rip=%Z\n", tf->tf_rip); 142 uint64_t val; 143 144 do { 145 val = in8(PS2_STATUS); 146 } while ((val & STATUS_IN_FULL) == 0); 147 148 val = in8(PS2_DATA); 149 150 x86_printf("-> got keyboard: rip=%Z key=%c ", tf->tf_rip, scancode_US[val]); 151 152 if (val & 0x80) 153 x86_printf("[released]\n"); 154 else 155 x86_printf("[pressed]\n"); 156 90 157 return; 91 158 }
Note: See TracChangeset
for help on using the changeset viewer.