Refactor & debug text

pull/38/head
E. Almqvist 3 years ago
parent 815a609009
commit c0ed208cb5
  1. 3
      drivers/vga.c
  2. 4
      kernel/kernel.c
  3. 6
      kernel/memory.c

@ -85,7 +85,7 @@ void printalign(char* str, int attribute_byte, enum align alignment) {
unsigned int strlenbuf = strlen(str);
if( !alignment || alignment == LEFT ) {
print(str, attribute_byte);
set_cursor_pos(0, cursor_row);
} else if ( alignment == RIGHT ) {
set_cursor_pos(MAX_COLS - strlenbuf, cursor_row);
} else if ( alignment == MIDDLE ) {
@ -93,4 +93,5 @@ void printalign(char* str, int attribute_byte, enum align alignment) {
}
print(str, attribute_byte);
set_cursor_pos(0, cursor_row+1);
}

@ -27,6 +27,8 @@ void init() {
// Memory allocation testing
printalign("-- PMM Tests --", DEFAULT_COLOR, MIDDLE);
println("THESE ALLOC SHOULD WORK:", 0xa0);
for(int i=0; i < 4; i++) {
block_alloc(i);
@ -39,6 +41,8 @@ void init() {
block_free(2); // after this, allocation of 2nd block should work
block_alloc(2);
printalign("-- End of PMM Tests --", DEFAULT_COLOR, MIDDLE);
char* strbuf = "Concat test: ";
char* str2 = "Works!";
strbuf = strcat(strbuf, str2);

@ -15,7 +15,7 @@
#define CHECK_BITMAP(map, idx) ((map) & (1<<(idx)))
#define BLOCK_TO_MEMP(idx) idx
#define BLOCK_TO_MEMP(idx) (int*)(PM_MEM_START + (idx*BLOCK_SIZE))
static int bitmap = 0;
@ -40,11 +40,11 @@ int* block_alloc(uint blockidx) {
mod_bitmap(blockidx, 1);
last_block = blockidx;
return 0; // placeholder
return BLOCK_TO_MEMP(blockidx); // placeholder
} else {
println("ERROR! Attemped to allocate non-free block.", 0x0c);
return -1;
return 0;
}
}

Loading…
Cancel
Save