mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2024-10-27 20:34:19 +00:00
Merge 0bbbdf7cf8
into ce8e050d24
This commit is contained in:
commit
767a01cbd2
@ -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);
|
||||
|
@ -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…
Reference in New Issue
Block a user