Skip to content

Commit

Permalink
+ | Fixing NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
BolvicBolvicovic committed Sep 12, 2024
1 parent 4c4415d commit 7b1b1b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions kernel/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ void kernel_main(uint32_t magic, uint32_t addr) {
asm volatile("mov %%cr0, %0" : "=r" (cr0));
if (cr0 & 0x80000000) printf("Paging enabled: cr0 == %p\n", cr0);
else printf("Paging disabled: cr0 == %p\n", cr0);
uint32_t* test = kmalloc(0xFFFFFFF);
uint32_t* test = kmalloc(1);
printf("test: %p sizeof(test) == %d bytes and value %d\n", test, kget_size(test), *test);
kfree(test);
void* test2 = kmalloc(1);
void* test3 = kmalloc(0x1001);
test = (uint32_t*)1;
*test = 5;
void* test3 = kmalloc(0x1001);
printf("test %p | test2 %p | test3 %p\n", test, test2, test3);
printf("sizeof(test) == %d bytes and value %d\n", kget_size(test), *test);
}
4 changes: 2 additions & 2 deletions memory/vmm/kmalloc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "vmm.h"

// #define MAX_ALLOC_SAME_TIME 0x1000
#define MAX_ALLOC_SAME_TIME 0x1 // Debug value
#define MAX_ALLOC_SAME_TIME 0x1000
//#define MAX_ALLOC_SAME_TIME 0x1 // Debug value
#define MAX_SIZE_ALLOC_SAME_TIME 0xFFFFF

typedef struct {
Expand Down

0 comments on commit 7b1b1b0

Please sign in to comment.