- add a more precise calculation of the kernel position
git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@122 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
d69807cbdc
commit
2d1ff7482b
2 changed files with 8 additions and 4 deletions
5
link.ld
5
link.ld
|
@ -1,10 +1,11 @@
|
|||
OUTPUT_FORMAT("binary")
|
||||
ENTRY(start)
|
||||
phys = 0x00100000;
|
||||
kernel_start = .;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text phys : AT(phys) {
|
||||
kernel_start = .;
|
||||
code = .;
|
||||
*(multiboot)
|
||||
*(.text)
|
||||
|
@ -24,6 +25,6 @@ SECTIONS
|
|||
. = ALIGN(4096);
|
||||
}
|
||||
end = .;
|
||||
kernel_end = .;
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
kernel_end = .;
|
||||
|
|
|
@ -142,16 +142,19 @@ int mmu_init(void)
|
|||
#error Currently, MetalSVM supports only Multiboot or the RockCreek processor!
|
||||
#endif
|
||||
|
||||
/* kernel is aligned to page size */
|
||||
kernel_size = (size_t) &kernel_end - (size_t) &kernel_start;
|
||||
if (kernel_size % PAGE_SIZE)
|
||||
kernel_size += PAGE_SIZE - kernel_size % PAGE_SIZE;
|
||||
atomic_int32_add(&total_allocated_pages, kernel_size/PAGE_SIZE);
|
||||
atomic_int32_sub(&total_available_pages, kernel_size/PAGE_SIZE);
|
||||
|
||||
/* set kernel space as used */
|
||||
for(i=(size_t) &kernel_start / PAGE_SIZE; i < (size_t) &kernel_end / PAGE_SIZE; i++)
|
||||
page_set_mark(i);
|
||||
if ((size_t) &kernel_end % PAGE_SIZE)
|
||||
page_set_mark(i);
|
||||
|
||||
alloc_start = (unsigned int) (&kernel_end) / PAGE_SIZE + 1;
|
||||
alloc_start = (unsigned int) (&kernel_end) / PAGE_SIZE;
|
||||
alloc_start += 128*1024;
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue