aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2019-10-31 23:14:05 +0100
committerMarvin Borner2019-10-31 23:14:05 +0100
commitbe023cf57d763ff5b17dbb2a3afec156ca54a65d (patch)
tree39c3e562319bdb8cf605f4e0f73851427189eaf7
parentc7e755cb843593db1eedb26c5c24932bbe743745 (diff)
Fixed several warnings
-rw-r--r--Makefile2
-rw-r--r--src/bootloader/make_initrd.c4
-rw-r--r--src/kernel/graphics/vesa.c4
-rw-r--r--src/kernel/input/ps2/keyboard.c4
4 files changed, 8 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 374a85b..9d59a76 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ build: clean
mkdir -p ./iso/boot/grub; \
cp ./build/melvix.bin ./iso/boot/; \
cp ./src/bootloader/grub.cfg ./iso/boot/grub/; \
- gcc -w ./src/bootloader/make_initrd.c -o ./build/make_initrd || exit; \
+ gcc ./src/bootloader/make_initrd.c -o ./build/make_initrd || exit; \
./build/make_initrd ./src/bootloader/test.txt test.txt || exit; \
mv initrd.img ./iso/boot/melvix.initrd || exit; \
grub-mkrescue -o ./build/melvix.iso ./iso/;
diff --git a/src/bootloader/make_initrd.c b/src/bootloader/make_initrd.c
index d7e0487..2ee4716 100644
--- a/src/bootloader/make_initrd.c
+++ b/src/bootloader/make_initrd.c
@@ -1,4 +1,6 @@
#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
struct initrd_header {
unsigned char magic;
@@ -10,7 +12,7 @@ struct initrd_header {
int main(char argc, char **argv) {
int nheaders = (argc - 1) / 2;
struct initrd_header headers[64];
- printf("size of header: %d\n", sizeof(struct initrd_header));
+ printf("size of header: %d\n", (int) sizeof(struct initrd_header));
unsigned int off = sizeof(struct initrd_header) * 64 + sizeof(int);
for (int i = 0; i < nheaders; i++) {
diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c
index 858ed95..ba8d84b 100644
--- a/src/kernel/graphics/vesa.c
+++ b/src/kernel/graphics/vesa.c
@@ -24,14 +24,14 @@ struct edid_data get_edid() {
regs.ax = 0x4F15;
regs.bx = 0x01; // BL
regs.es = 0;
- regs.di = (unsigned short) edid;
+ regs.di = (uintptr_t) &edid;
paging_disable();
int32(0x10, &regs);
paging_enable();
kfree(edid);
- return *edid;
+ return *(struct edid_data *) edid;
}
void vbe_set_mode(unsigned short mode) {
diff --git a/src/kernel/input/ps2/keyboard.c b/src/kernel/input/ps2/keyboard.c
index 87006b6..7e01af5 100644
--- a/src/kernel/input/ps2/keyboard.c
+++ b/src/kernel/input/ps2/keyboard.c
@@ -71,7 +71,7 @@ void keyboard_handler(struct regs *r) {
scan_code = receive_b(0x60);
- if (!(scan_code & 0x80)) { // PRESS
+ if ((scan_code & 0x80) == 0) { // PRESS
// TODO: Fix caps lock deactivation when pressing shift while shifted
if (current_keymap[scan_code] == 14 || (current_keymap[scan_code] == 15 && !shift_pressed)) {
shift_pressed = 1;
@@ -81,7 +81,7 @@ void keyboard_handler(struct regs *r) {
return;
}
vesa_keyboard_char(current_keymap[scan_code]);
- } else if (scan_code & 0x80) { // RELEASE
+ } else { // RELEASE
char key = current_keymap[scan_code];
if (key == 14) shift_pressed = 0;
}