pull/98/merge
Garen Chan 8 months ago committed by GitHub
commit 767a01cbd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,7 +6,7 @@
static void keyboard_callback(registers_t regs) {
/* The PIC leaves us the scancode in port 0x60 */
u8 scancode = port_byte_in(0x60);
char *sc_ascii;
char sc_ascii[4];
int_to_ascii(scancode, sc_ascii);
kprint("Keyboard scancode: ");
kprint(sc_ascii);
@ -99,24 +99,24 @@ void print_letter(u8 scancode) {
case 0x19:
kprint("P");
break;
case 0x1A:
kprint("[");
break;
case 0x1B:
kprint("]");
break;
case 0x1C:
kprint("ENTER");
break;
case 0x1D:
kprint("LCtrl");
break;
case 0x1E:
kprint("A");
break;
case 0x1F:
kprint("S");
break;
case 0x1A:
kprint("[");
break;
case 0x1B:
kprint("]");
break;
case 0x1C:
kprint("ENTER");
break;
case 0x1D:
kprint("LCtrl");
break;
case 0x1E:
kprint("A");
break;
case 0x1F:
kprint("S");
break;
case 0x20:
kprint("D");
break;
@ -147,24 +147,24 @@ void print_letter(u8 scancode) {
case 0x29:
kprint("`");
break;
case 0x2A:
kprint("LShift");
break;
case 0x2B:
kprint("\\");
break;
case 0x2C:
kprint("Z");
break;
case 0x2D:
kprint("X");
break;
case 0x2E:
kprint("C");
break;
case 0x2F:
kprint("V");
break;
case 0x2A:
kprint("LShift");
break;
case 0x2B:
kprint("\\");
break;
case 0x2C:
kprint("Z");
break;
case 0x2D:
kprint("X");
break;
case 0x2E:
kprint("C");
break;
case 0x2F:
kprint("V");
break;
case 0x30:
kprint("B");
break;

@ -18,7 +18,7 @@ Right now we have a `utils.c` which we will split into `mem.c` and `string.c`, w
Second, we will create a new function `irq_install()` so that the kernel
only needs to perform one call to initialize all the IRQs. That function
is akin to `isr_install()` and placed on the same `irq.c`.
is akin to `isr_install()` and placed on the same `isr.c`.
While we're here, we will disable the `kprint()` on `timer_callback()`
to avoid filling the screen with junk, now that we know that it works
properly.

@ -1,5 +1,5 @@
#ifndef STRINGS_H
#define STRINGS_H
#ifndef STRING_H
#define STRING_H
void int_to_ascii(int n, char str[]);
void reverse(char s[]);

@ -15,7 +15,7 @@ our first page starts at 0x10000 (as hardcoded on `mem.c`) and
subsequent `kmalloc()`'s produce a new address which is
aligned 4096 bytes or 0x1000 from the previous one.
Note that we added a new `strings.c:hex_to_ascii()` for
Note that we added a new `string.c:hex_to_ascii()` for
nicer printing of hex numbers.
Another cosmetic modification is to rename `types.c` to

@ -1,5 +1,5 @@
#ifndef STRINGS_H
#define STRINGS_H
#ifndef STRING_H
#define STRING_H
void int_to_ascii(int n, char str[]);
void hex_to_ascii(int n, char str[]);

@ -79,7 +79,7 @@ We add `cld` just before `call isr_handler` on `cpu/interrupt.asm` as suggested
by the osdev wiki.
There is a final, important issue with `cpu/interrupt.asm`. The common stubs create an instance
of `struct registers` on the stack and then call the C handler. But that breaks the ABI, since
of `struct registers_t` on the stack and then call the C handler. But that breaks the ABI, since
the stack belongs to the called function and they may change them as they please. It is needed
to pass the struct as a pointer.

@ -1,5 +1,5 @@
#ifndef STRINGS_H
#define STRINGS_H
#ifndef STRING_H
#define STRING_H
void int_to_ascii(int n, char str[]);
void hex_to_ascii(int n, char str[]);

Loading…
Cancel
Save