Bitmap thing

pull/38/head
E. Almqvist 3 years ago
parent 0529ecc298
commit 95e2f274e3
  1. 2
      Makefile
  2. 14
      kernel/memory.c
  3. 9
      kernel/memory.h
  4. 0
      kernel/sr_memory.asm
  5. 1
      lib/types.h

@ -22,7 +22,7 @@ eos_grub.iso : kernel.bin grub/grub.cfg
eos.iso: bootloader/bootloader.bin kernel.bin eos.iso: bootloader/bootloader.bin kernel.bin
cat $^ > eos.iso cat $^ > eos.iso
kernel.bin: kernel/kernel_entry.o kernel/enable_paging.o $(OBJ) kernel.bin: kernel/kernel_entry.o kernel/sr_memory.o kernel/enable_paging.o $(OBJ)
gcc -o $@ $^ -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32 gcc -o $@ $^ -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32

@ -7,8 +7,18 @@
// i.e. : bit i of byte n define status of block 8n+i // i.e. : bit i of byte n define status of block 8n+i
// block = 8n+i // block = 8n+i
int* alloc_cursor; // keep track of last location that was allocated (may improve speed) // in 32-bit mode, we have access to 2^32 blocks
// which is (2^32)*BLOCK_SIZE blocks
// and with a blocksize of 1024, we git around 4.3 trillion blocks
// which is more than enough
void init_pmm(unsigned int map_addr, unsigned int bsize) { int bitmap = 0;
enum bitmap_flag {
FREE,
ALLOC
};
void mod_bitmap(uint block, uint bit, uint bflag) {
} }

@ -1,5 +1,10 @@
#define BLOCK_SIZE 4 // 32 bits = 4 bytes #include "../lib/types.h"
#define BLOCK_SIZE 1024 // 1 KiB
#define MEMSIZE_TO_BLOCKS(n) ((n*1024)/BLOCK_SIZE) #define MEMSIZE_TO_BLOCKS(n) ((n*1024)/BLOCK_SIZE)
void init_pmm(unsigned int map_addr, unsigned int bsize); // Initialize physical memory manager enum bitmap_flag;
// void init_pmm(uint map_addr, uint bsize); // Initialize physical memory manager
void mod_bitmap(uint block, uint bit, uint flag);

@ -0,0 +1 @@
typedef unsigned int uint;
Loading…
Cancel
Save