diff options
| author | Aleksa Vuckovic <aleksav013@gmail.com> | 2022-08-07 16:39:28 +0200 |
|---|---|---|
| committer | Aleksa Vuckovic <aleksav013@gmail.com> | 2022-08-07 16:43:26 +0200 |
| commit | 71396c5cd460890c52e348687e6e7c864e2dfeed (patch) | |
| tree | 72e7dd114cea46c5209dba2e0c2ed9ffeb7f55b5 /kernel/src/misc | |
| parent | 50aaae893611af890a6855158ad0a3e32c7b2c43 (diff) | |
types.h; libk and heap begining
Diffstat (limited to 'kernel/src/misc')
| -rw-r--r-- | kernel/src/misc/debug.c | 2 | ||||
| -rw-r--r-- | kernel/src/misc/graphics.c | 18 |
2 files changed, 4 insertions, 16 deletions
diff --git a/kernel/src/misc/debug.c b/kernel/src/misc/debug.c index 5f3c327..2a940d3 100644 --- a/kernel/src/misc/debug.c +++ b/kernel/src/misc/debug.c @@ -1,5 +1,3 @@ -#include <stdint.h> - void bochs_breakpoint(void) { __asm__ volatile ("xchgw %bx, %bx;"); diff --git a/kernel/src/misc/graphics.c b/kernel/src/misc/graphics.c index d4fc7c7..488e4fa 100644 --- a/kernel/src/misc/graphics.c +++ b/kernel/src/misc/graphics.c @@ -1,7 +1,10 @@ -#include <stdint.h> +#include <types.h> + #include <multiboot2.h> #include <graphics.h> #include <font.h> +#include <libk/string.h> +#include <libk/math.h> uint64_t* pixel_offset(fb_t fb, uint32_t x, uint32_t y) { @@ -65,12 +68,6 @@ void fb_draw_line_high(fb_t fb, int32_t x0, int32_t y0, int32_t x1, int32_t y1, } } -int32_t abs(int32_t val) -{ - if (val < 0) return -val; - return val; -} - void fb_draw_line(fb_t fb, int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t col) { if (abs(y1 - y0) < abs(x1 - x0)) { @@ -104,13 +101,6 @@ void fb_draw_character(fb_t fb, char c, uint32_t x, uint32_t y, uint32_t char_co } } -uint32_t strlen(const char* s) -{ - char *p = (char*)s; - while (*p) p++; - return p - s; -} - void fb_draw_string(fb_t fb, const char* s, uint32_t x, uint32_t y, uint32_t char_col, uint32_t bg_col) { for (uint32_t i = 0; i < strlen(s); i++) { |
