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 Detection #1

Closed
vmartinv opened this issue Sep 17, 2014 · 2 comments
Closed

Memory Detection #1

vmartinv opened this issue Sep 17, 2014 · 2 comments

Comments

@vmartinv
Copy link

I think you're misunderstood the multiboot information about mem_upper(amount of KB available after the first 1MB addresses) and mem_lower(amount of RAM avalaible in the first 1MB addresses of the RAM) because of this line:

init_malloc(0, multiboot->mem_upper * 1024);

It seems your are going with the upper memory, but you are allocating just after the kernel!. Also note that it may exist a unusable gap between lower and upper memory. This explains all very well: http://wiki.osdev.org/Detecting_Memory_(x86)#Memory_Map_Via_GRUB

And thank you for doing this, I'm beggining with kernels and your project is helping me a lot to understand the basics, the code is very clean.

@vmartinv
Copy link
Author

I was completely wrong, now i understand(i think), you're putting the kernel in the upper memory. But your code is not right still: You don't have that amount of bytes avalaible. I suggest this change:

init_malloc(0, multiboot->mem_upper * 1024 - (pre_placementaddr - (intptr_t)&_kernel_start));

Please excuse me if i'm making any mistakes.

@Ryanel
Copy link
Owner

Ryanel commented Oct 4, 2014

The kernel is placed by grub into the first megabyte, however yes the malloc statement is borked - this is a temporary kernel heap. This current irritation of Cedille is proof of concept and no longer updated; it was to get the concepts working while not doing anything with them. However, the rw branch contains a rewrite of the kernel source in its early stages. Please, review the old code, but check out the new code as well. Nothing relating to mm is in yet, but its still rather clean (thanks for that!). I will, however, take your ideas into account. Thanks very much.

@Ryanel Ryanel closed this as completed Oct 5, 2014
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