cfenollosa_os-tutorial/22-malloc
Hennik Hunsaker 7d932d43b3 Add Pandoc Support
- Add a Pandoc defaults file
- Add a Pandoc template based on the default one
- Add chapter headers to each section

### Usage

To use, install Pandoc and ConTeXt, then simply run
`pandoc -d ./pandoc.yaml` from the repo root.

### Maintenance

When new chapters get added, the `pandoc.yaml` will need to be updated
to include each new chapter's markdown file(s).

### Miscellaneous Notes

- The PDF generated complies with PDF/A 1b:2005 by default.
- The PDF also contains the source markdown files as attachments
- All links are fully functional!
- Includes a table of contents! With links to each section!

### Conclusion

Enjoy!
2023-09-05 01:46:32 -06:00
..
cpu lesson 22 2015-05-18 09:39:50 +02:00
drivers lesson 22 2015-05-18 09:39:50 +02:00
kernel lesson 22 2015-05-18 09:39:41 +02:00
libc lesson 22 2015-05-18 09:39:41 +02:00
boot lesson 22, malloc 2015-04-01 15:08:17 +02:00
Makefile lesson 22, malloc 2015-04-01 15:08:17 +02:00
README.md Add Pandoc Support 2023-09-05 01:46:32 -06:00

malloc

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.