logs archiveBotHelp.net / Freenode / #2f30 / 2015 / August / 6 / 1
stateless
tm512, so the magic number matches I take it?
tm512
yeah. I've got it working now
stateless
what was it?
tm512
the "-4" is misleading bullsh*t
thanks GNU
stateless
ah :)
tm512
just writing my page frame allocator
stateless
nice
bitmap based?
tm512
linked list I think
stateless
hm
bitmap is easier I think, but you can allocate a list nodes inside a page
tm512
just a list of struct page_s { uint64_t addr; struct page_s *next; }
stateless
with a bitmap u can check one bit to tell if a page is free
tm512
pop an entry from the list, you've got your free physical address to map
yeah with this it's just O(1) though to allocate
stateless
with a bitmap u preallocate it for i386
for amd64 not so easy but you can expand very rarely
tm512
page *ret = pfalist;
pfalist = ret->next;
return ret
stateless
will u remove entries from that list?
or have separate allocated/free lists
tm512
well each process will have its allocated list
stateless
I am talking about the system wide phys page allocator
processes will deal with virt mem
and it will be multiplexed across your global phys page/frame allocator
tm512
the kernel will have structures for each process
that structure will hold a list of pages the process holds
stateless
yes but you still need to choose a free phys page to map
the phys page allocator is below the mechanism that chooses which pages to map
tm512
that's the page frame allocator
stateless
this is the difference between frame and page
yes, so for the page frame allocator
tm512
I'm just building a list of free memory pages
stateless
are you using a bitmap or sth else? (was the linked list approach referring to that?)
ok
tm512
when the kernel needs a new one, it will pop one off the list
and that contains the physical address
stateless
so if I want to enumerate all the in-use frames, I need to iterate over all processes and check for each page to which frame it is mapped
why remove the node at all?
tm512
I dunno, I'm confused
the osdev wiki says this is a page frame allocator. I'm just making a way for the kernel to allocate free memory addresses to map into virtual address space when necessary
stateless
say I want to dump all the page frames that are in-use in the system
yes
well it is a way to keep track of which frames in physical memory are allocated/free
to allow you to set up a virt -> phys mapping
tm512
yeah that's exactly what I'm doing
when the process needs pages it will ask the kernel
stateless
cool so
yes
tm512
and the kernel will map it into the process' VM
stateless
so your kernel is map va == pa right?
mapped*
tm512
identity mapping?
stateless
yes
tm512
not exactly
stateless
do you relocate it?
tm512
I'm not that far yet
stateless
in any case, at a constant offset
tm512
but that was the plan
stateless
u will have to make sure that your linked list of free physical frames, is also identity mapped
it needs some bootstrapping to "place" the nodes
tm512
I think I already have that worked out
stateless
with a bitmap approach, you just map a sufficiently large block of bits to accomodate all available physical memory
so it only requires reserving a pool identity mapped
then u can just access it
tm512
I'm reserving a chunk of memory for an initial linked list buffer
so that I don't have to worry about allocating a page before I can make my allocator
stateless
ur virtual memory allocator, for kernel space itself can be what you are designing now for your page frame allocator
yeah
tm512
I don't think I'm doing anything special for virtual memory allocation, that's going to be in usermode
stateless
tm512, you need virt memory allocation in kernel space
tm512
I don't think I do
stateless
ok take this
tm512
I'll just grow the application heap and it can allocate that how it wants to
stateless
struct foo *f = kmalloc(sizeof(*f));
how will you do that?
in kernel space
you are talking about userspace
yes you don't need to worry about that, as long as you provide sbrk() or mmap()
but the kernel itself needs to make allocations on its own heap
it is a convenience, you can't just map pages for everything, that's wasteful
to do that you need some sort of allocator
any will do
tm512
the kmalloc will probably just be a copy of the userspace one
stateless
yes
you can do that
but a simpler one will do
tm512
the kernel isn't going to need to allocate much at all
stateless
it is
tm512
I am doing a microkernel approach
stateless
well process state
ur stack is limited
anything more than 256 bytes is bad practice even if u have 4k stacks
tm512
for kernel stack I'm just going to have a single page
stateless
4k yes
tm512
nah 2M
using 2M pages
stateless
lol
« prev 1 2 3 4 next »