Bitmap bugs

pull/38/head
E. Almqvist 3 years ago
parent 684785a49d
commit c1c9248e1e
  1. 8
      drivers/vga.c
  2. 1
      drivers/vga.h
  3. 5
      kernel/memory.c

@ -2,6 +2,7 @@
#include "vga.h" #include "vga.h"
#include "../kernel/io.h" #include "../kernel/io.h"
#include "../lib/str.h" #include "../lib/str.h"
#include "../lib/strf.h"
static unsigned int cursor_row = 0; static unsigned int cursor_row = 0;
static unsigned int cursor_col = 0; static unsigned int cursor_col = 0;
@ -69,6 +70,13 @@ void println(char* str, int attribute_byte) {
cursor_row++; // Increment to next y-pos (newline) cursor_row++; // Increment to next y-pos (newline)
} }
void printint(int i, int attribute_byte) {
char* strbuf;
strbuf = int_to_str(i, strbuf);
println(strbuf, attribute_byte);
}
void printalign(char* str, int attribute_byte, enum align alignment) { void printalign(char* str, int attribute_byte, enum align alignment) {
unsigned int strlenbuf = strlen(str); unsigned int strlenbuf = strlen(str);

@ -17,5 +17,6 @@ void clear_row(unsigned int row);
void set_cursor_pos(); void set_cursor_pos();
void print(); void print();
void println(); void println();
void printint(int i, int attribute_byte);
void printalign(char* str, int attribute_byte, enum align alignment); void printalign(char* str, int attribute_byte, enum align alignment);
void vga_init(); void vga_init();

@ -15,7 +15,7 @@
#define CHECK_BITMAP(map, idx) ((map) & (1<<(idx))) #define CHECK_BITMAP(map, idx) ((map) & (1<<(idx)))
int bitmap = 0; static int bitmap = 0;
void mod_bitmap(uint bit, uint bflag) { void mod_bitmap(uint bit, uint bflag) {
// create a bitmask that will be applied to the bitmap // create a bitmask that will be applied to the bitmap
int bitmask = 1 << bit; int bitmask = 1 << bit;
@ -38,7 +38,8 @@ int block_alloc(uint blockidx) {
return 0; // placeholder return 0; // placeholder
} else { } else {
println("ERROR! Attemped to allocate non-free block.", 0x0c); println("ERROR! Attemped to allocate non-free block.", 0x0c);
println(block_bflag, 0x9c); printint(block_bflag, 0x9c);
return -1; return -1;
} }
} }

Loading…
Cancel
Save