Kernel updates since December 2009

This commit is contained in:
Bahadir Balban
2010-03-25 01:12:40 +02:00
parent 16818191b3
commit 74b5963fcb
487 changed files with 22477 additions and 3857 deletions

View File

@@ -12,28 +12,20 @@ sys.path.append(PROJRELROOT)
from config.projpaths import *
from configure import *
config = configuration_retrieve()
Import('env')
KERNEL_INCLUDE = join(PROJROOT, 'include')
LIBL4_RELDIR = 'conts/libl4'
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],
ENV = {'PATH' : os.environ['PATH']},
LIBS = 'gcc',
CPPPATH = ['.', KERNEL_INCLUDE, LIBL4_INCLUDE],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
e = env.Clone()
e.Append(CPPPATH = ['include', '.', LIBL4_INCLUDE])
objmm = env.StaticObject(Glob('mm/*.c'))
objmc = env.StaticObject(Glob('memcache/*.[cS]'))
objmalloc = env.StaticObject(Glob('malloc/*.[cS]'))
libmm = env.StaticLibrary('mm', objmm)
libmc = env.StaticLibrary('mc', objmc)
libmalloc = env.StaticLibrary('malloc', objmalloc)
objmm = e.StaticObject(Glob('mm/*.c'))
objmc = e.StaticObject(Glob('memcache/*.[cS]'))
objmalloc = e.StaticObject(Glob('malloc/*.[cS]'))
libmm = e.StaticLibrary('mm', objmm)
libmc = e.StaticLibrary('mc', objmc)
libmalloc = e.StaticLibrary('malloc', objmalloc)
Return('libmm', 'libmc', 'libmalloc')

View File

@@ -10,7 +10,9 @@ PROJRELROOT = '../..'
sys.path.append(PROJRELROOT)
from configure import *
from config.projpaths import *
config = configuration_retrieve()
gcc_arch_flag = config.gcc_arch_flag
headers_root = join(PROJRELROOT, "include/l4")
config_h = join(headers_root, "config.h")
@@ -28,21 +30,24 @@ tests_dir = tests
LIBL4_RELDIR = 'conts/libl4'
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
test_env = Environment(CC = 'gcc -m32',
CCFLAGS = ['-g', '-std=gnu99', '-Wall', '-Werror'],
# This does not work, need to check
test_env = Environment(CC = config.toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
'-nostdinc', '-Werror', '-march=' + gcc_arch_flag],
ENV = {'PATH' : os.environ['PATH']},
LIBS = ['gcc', 'mm', 'km', 'mc'],
LIBS = ['mm', 'km', 'mc'],
LIBPATH = ['#'],
CPPPATH = ['#include', join(PROJRELROOT, "include"), "#", LIBL4_INCLUDE])
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-Wall', '-Werror', '-ffreestanding', '-std=gnu99'],
LINKFLAGS = ['-nostdlib'],
ENV = {'PATH' : os.environ['PATH']},
LIBS = 'gcc',
CPPPATH = [join(PROJRELROOT, "include"), "#", LIBL4_INCLUDE])
env = Environment(CC = config.toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', \
'-Wall', '-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],
ENV = {'PATH' : os.environ['PATH']},
LIBS = 'gcc',
CPPPATH = ['.', join(PROJROOT, 'include'), LIBL4_INCLUDE])
if os.path.exists(config_h) is False:
print "\nThis build requires a valid kernel configuration header."

View File

@@ -179,12 +179,13 @@ struct mem_cache *mem_cache_init(void *start,
unsigned int diff = addr_aligned - addr;
BUG_ON(diff >= struct_size);
if (diff)
total--;
cache_size -= diff;
area_start = addr_aligned;
}
/* Now recalculate total over cache bytes left */
total = cache_size / struct_size;
link_init(&cache->list);
cache->start = area_start;
cache->end = area_start + cache_size;

View File

@@ -9,12 +9,13 @@
#include <l4/macros.h>
#include <l4/types.h>
#include <l4/lib/list.h>
#include <l4lib/arch/syscalls.h>
#include <l4lib/arch/syslib.h>
#include "alloc_page.h"
#include INC_GLUE(memory.h)
#include INC_SUBARCH(mm.h)
#include INC_GLUE(memlayout.h)
#include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syscalls.h)
#include L4LIB_INC_ARCH(syslib.h)
struct page_allocator allocator;
@@ -95,7 +96,7 @@ void init_page_allocator(unsigned long start, unsigned long end)
link_init(&allocator.pga_cache_list);
/* Initialise the first page area cache */
cache = mem_cache_init(l4_map_helper((void *)start, 1), PAGE_SIZE,
cache = mem_cache_init(phys_to_virt((void *)start), PAGE_SIZE,
sizeof(struct page_area), 0);
list_insert(&cache->list, &allocator.pga_cache_list);
@@ -134,7 +135,6 @@ int check_page_areas(struct page_allocator *p)
{
struct page_area *new;
struct mem_cache *newcache;
void *newpage;
/* If only one free area left */
if (p->pga_free == 1) {
@@ -146,12 +146,9 @@ int check_page_areas(struct page_allocator *p)
/* Free page areas must now be reduced to 0 */
BUG_ON(p->pga_free != 0);
/* Map the new page into virtual memory */
newpage = l4_map_helper((void *)__pfn_to_addr(new->pfn), 1);
/* Initialise it as a new source of page area structures */
newcache = mem_cache_init(newpage, PAGE_SIZE,
sizeof(struct page_area), 0);
newcache = mem_cache_init(phys_to_virt((void *)__pfn_to_addr(new->pfn)),
PAGE_SIZE, sizeof(struct page_area), 0);
/*
* Update the free page area counter
@@ -209,7 +206,12 @@ struct page_area *merge_free_areas(struct page_area *before,
/* Recursively free the cache page */
if (mem_cache_is_empty(c)) {
list_remove(&c->list);
BUG_ON(free_page(l4_unmap_helper(c, 1)) < 0)
if (free_page(virt_to_phys(c)) < 0) {
printf("Page ptr: 0x%lx, virt_to_phys = 0x%lx\n"
"Page not found in cache.\n",
(unsigned long)c, (unsigned long)virt_to_phys(c));
BUG();
}
}
return before;
}

View File

@@ -1,7 +1,7 @@
#ifndef __DEBUG_H__
#define __DEBUG_H__
#include <kmalloc/kmalloc.h>
//#include <kmalloc/kmalloc.h>
#include <mm/alloc_page.h>
#include <l4/lib/list.h>

View File

@@ -10,7 +10,7 @@
#include INC_SUBARCH(mm.h)
#include INC_ARCH(linker.h)
#include INC_PLAT(printascii.h)
#include INC_PLAT(print-early.h)
#include INC_PLAT(offsets.h)
#include INC_GLUE(memlayout.h)