Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory question #5

Closed
foudfou opened this issue Jul 18, 2022 · 1 comment
Closed

Memory question #5

foudfou opened this issue Jul 18, 2022 · 1 comment

Comments

@foudfou
Copy link

foudfou commented Jul 18, 2022

Hi there, thank you so much as I'm learning a lot from your project! I am currently tackling paging.

I have a question about this line

if (kheap_curr + size > KMEM_MAX)

Something I'm not sure to understand is: while kheap_curr is initialized to a page-aligned memory address right after the kernel, which itself is loaded to 1MiB, we compare kheap_curr to something that looks like a quantity:

#define KMEM_MAX 0x00800000     /** 8MiB reserved for the kernel. */

In practice, KMEM_MAX is used as an address, and the comment should read something like: /* Max address reserved for the kernel */.

What am I missing?

@josehu07
Copy link
Owner

Hi there, thanks for asking.

Yes, your understanding is correct. 8MiB is the max address reserved for kernel stuff. The comment should read up to 8MiB reserved for the kernel.

The amount of available memory for kernel heap and slabs will be less than 8MiB.

@foudfou foudfou closed this as completed Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants