1 //----------------------------------------------------------------------------
2 IMPLEMENTATION [ppc32]:
4 #include "mem_region.h"
6 Kmem_alloc::Kmem_alloc()
8 Mword alloc_size = Config::Kmem_size;
9 unsigned long max = ~0UL;
10 #warning This code needs adaption (see e.g. the arm version)
13 Mem_region r; r.start=3; r.end=1; // = Kip::k()->last_free(max);
15 if (r.start > r.end + 1)
16 panic("Corrupt memory descscriptor in KIP...");
18 if (r.start == r.end + 1)
19 panic("Could not acquire enough kernel memory");
22 Mword size = r.end - r.start + 1;
23 if(alloc_size <= size)
25 r.start += (size - alloc_size);
26 Kip::k()->add_mem_region(Mem_desc(r.start, r.end,
29 /* init buddy allocator with physical addresses */
31 a->add_mem((void*)r.start, alloc_size);
32 printf("Buddy allocator at: [%08lx; %08lx] - %lu KB\n",
33 r.start, r.end, alloc_size / 1024);
39 PUBLIC inline //NEEDS["kmem_space.h"]
41 Kmem_alloc::to_phys(void *v) const
44 //return Kmem_space::kdir()->virt_to_phys((Address)v);
48 //----------------------------------------------------------------------------
49 IMPLEMENTATION [ppc32 && debug]:
57 void Kmem_alloc::debug_dump()