This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
OS_Project/Part3/09_memory
Jonathan Turner 7448b59251 maybe?
2023-11-29 17:37:16 -05:00
..
boot Leaving this Install and moving to new OS in VM. 2023-11-07 12:44:50 -05:00
cpu Leaving this Install and moving to new OS in VM. 2023-11-07 12:44:50 -05:00
drivers Leaving this Install and moving to new OS in VM. 2023-11-07 12:44:50 -05:00
kernel maybe? 2023-11-29 17:37:16 -05:00
libc maybe breaking alot here. 2023-11-29 17:35:59 -05:00
_Makefile Provided Files 2023-10-18 14:04:33 -04:00
kernel.bin Leaving this Install and moving to new OS in VM. 2023-11-07 12:44:50 -05:00
Makefile Provided Files 2023-10-18 14:04:33 -04:00
os-image.bin Leaving this Install and moving to new OS in VM. 2023-11-07 12:44:50 -05:00
README.md Provided Files 2023-10-18 14:04:33 -04:00

Concepts you may want to Google beforehand: malloc

Goal: Implement a memory allocator

We will add a kernel memory allocator to libc/mem.c. It is implemented as a simple pointer to free memory, which keeps growing.

The kmalloc() function can be used to request an aligned page, and it will also return the real, physical address, for later use.

We'll change the kernel.c leaving all the "shell" code there, Let's just try out the new kmalloc(), and check out that our first page starts at 0x10000 (as hardcoded on mem.c) and subsequent kmalloc()'s produce a new address which is aligned 4096 bytes or 0x1000 from the previous one.

Note that we added a new strings.c:hex_to_ascii() for nicer printing of hex numbers.

Another cosmetic modification is to rename types.c to type.c for language consistency.

The rest of the files are unchanged from last lesson.