Changes since April

Clean up of build directories.
Simplifications to capability model.
This commit is contained in:
Bahadir Balban
2010-06-01 15:08:13 +03:00
parent aef14b55ec
commit 6fa4884a5a
450 changed files with 10449 additions and 7383 deletions

View File

@@ -4,21 +4,23 @@
# #
# Copyright © 2009 B Labs Ltd # Copyright © 2009 B Labs Ltd
# #
import os, shelve # This Script is mainly concerned with(in the same order):
import configure # 1. Generating linker script for kernel.
from configure import * # 2. Generating cinfo.c file based on generated containers.
# 3. Calling scons recursively over various kernel subdirectories.
#
import os
from os.path import * from os.path import *
from scripts.config.config_invoke import *
config = configuration_retrieve() config = configuration_retrieve()
arch = config.arch arch = config.arch
subarch = config.subarch subarch = config.subarch
platform = config.platform platform = config.platform
gcc_arch_flag = config.gcc_arch_flag gcc_arch_flag = config.gcc_arch_flag
all_syms = config.all builddir = join(BUILDDIR, 'kernel')
builddir='build/codezero/'
# Generate kernel linker script at runtime using template file
# Generate kernel linker script at runtime using template file.
def generate_kernel_linker_script(target, source, env): def generate_kernel_linker_script(target, source, env):
linker_in = source[0] linker_in = source[0]
linker_out = target[0] linker_out = target[0]
@@ -28,86 +30,95 @@ def generate_kernel_linker_script(target, source, env):
('include', 'l4/platform/'+ platform + '/offsets.h', \ ('include', 'l4/platform/'+ platform + '/offsets.h', \
'l4/glue/' + arch + '/memlayout.h', linker_in, linker_out) 'l4/glue/' + arch + '/memlayout.h', linker_in, linker_out)
os.system(cmd) os.system(cmd)
return None
create_kernel_linker = Command(join(builddir, 'include/l4/arch/arm/linker.lds'), \
join(PROJROOT, 'include/l4/arch/arm/linker.lds.in'), \
generate_kernel_linker_script)
''' '''
# Generate linker file with physical addresses, # Generate kernel linker file with physical addresses
# to be used for debug purpose only # (to be used for debug purpose only)
def generate_kernel_phys_linker_script(target, source, env): def generate_kernel_phys_linker_script(target, source, env):
phys_linker_in = source[0] phys_linker_in = source[0]
phys_linker_out = target[0] phys_linker_out = target[0]
cmd = config.toolchain_kernel + "cpp -D__CPP__ " + \ cmd = config.toolchain_kernel + "cpp -D__CPP__ -Dkernel_offset=0 " + \
"-I%s -imacros l4/macros.h -imacros %s -imacros %s -C -P %s -o %s" % \ "-I%s -imacros l4/macros.h -imacros %s -imacros %s -C -P %s -o %s" % \
('include', 'l4/platform/'+ platform + '/offsets.h', \ ('include', 'l4/platform/'+ platform + '/offsets.h', \
'l4/glue/' + arch + '/memlayout.h', phys_linker_in, phys_linker_out) 'l4/glue/' + arch + '/memlayout.h', phys_linker_in, phys_linker_out)
os.system(cmd) os.system(cmd)
return None
create_kernel_phys_linker = Command(join(builddir, 'include/physlink.lds'), \
join(PROJROOT, 'include/l4/arch/arm/linker.lds.in'), \
generate_kernel_phys_linker_script)
''' '''
# Kernel build environment
env = Environment(CC = config.toolchain_kernel + 'gcc', env = Environment(CC = config.toolchain_kernel + 'gcc',
AR = config.toolchain_kernel + 'ar', AR = config.toolchain_kernel + 'ar',
RANLIB = config.toolchain_kernel + 'ranlib', RANLIB = config.toolchain_kernel + 'ranlib',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk(). # such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \ CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99',
'-Werror', '-march=' + gcc_arch_flag], '-Wall', '-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + join(builddir, 'include/l4/arch/arm/linker.lds')], LINKFLAGS = ['-nostdlib',
ASFLAGS = ['-D__ASSEMBLY__', '-march=' + gcc_arch_flag], '-T' + join(builddir, 'include/l4/arch/arm/linker.lds')],
PROGSUFFIX = '.elf', # The suffix to use for final executable ASFLAGS = ['-D__ASSEMBLY__', '-march=' + gcc_arch_flag],
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path # The suffix to use for final executable
LIBS = 'gcc', # libgcc.a - This is required for division routines. PROGSUFFIX = '.elf',
CPPPATH = ["#include"], # Inherit shell path
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h -D__KERNEL__') ENV = {'PATH' : os.environ['PATH']},
# libgcc.a - This is required for division routines.
LIBS = 'gcc',
CPPPATH = KERNEL_HEADERS,
CPPFLAGS = '-include l4/config.h -include l4/macros.h \
-include l4/types.h -D__KERNEL__')
objects = [] objects = []
objects += SConscript('src/generic/SConscript', objects += SConscript('src/generic/SConscript',
exports = {'symbols' : all_syms, 'env' : env}, exports = { 'env' : env }, duplicate = 0,
duplicate=0, build_dir=builddir + 'generic') build_dir = join(builddir, 'generic'))
objects += SConscript('src/glue/' + arch + '/SConscript', objects += SConscript(join(join('src/glue', arch), 'SConscript'),
exports = {'symbols' : all_syms, 'env' : env}, exports = { 'env' : env }, duplicate = 0,
duplicate=0, build_dir=builddir + 'glue' + '/' + arch) build_dir = join(builddir, join('glue',arch)))
objects += SConscript('src/arch/' + arch + '/SConscript', objects += SConscript(join(join('src/arch', arch), 'SConscript'),
exports = {'symbols' : all_syms, 'env' : env}, exports = { 'env' : env }, duplicate = 0,
duplicate=0, build_dir=builddir + 'arch/' + arch) build_dir = join(builddir, join('arch', arch)))
objects += SConscript('src/arch/' + arch + '/' + subarch + '/SConscript', objects += SConscript(join(join('src/arch', arch), join(subarch, 'SConscript')),
exports = {'symbols' : all_syms, 'env' : env}, exports = { 'env' : env }, duplicate = 0,
duplicate=0, build_dir=builddir + 'arch/' + arch + '/' + subarch) build_dir = join(builddir, join(join('arch',arch), subarch)))
objects += SConscript('src/lib/SConscript', objects += SConscript('src/lib/SConscript',
exports = {'symbols' : all_syms, 'env' : env}, exports = { 'env' : env }, duplicate = 0,
duplicate=0, build_dir=builddir + 'lib') build_dir = join(builddir, 'lib'))
objects += SConscript('src/api/SConscript', objects += SConscript('src/api/SConscript',
exports = {'symbols' : all_syms, 'env' : env}, exports = { 'env' : env }, duplicate = 0,
duplicate=0, build_dir=builddir + 'api') build_dir = join(builddir, 'api'))
objects += SConscript('src/drivers/SConscript', objects += SConscript('src/drivers/SConscript',
exports = {'symbols' : all_syms, 'env' : env, 'platform' : platform,'bdir' : 'driver/'}, exports = { 'env' : env, 'bdir' : 'driver/'}, duplicate = 0,
duplicate=0, build_dir=builddir) build_dir = join(builddir, 'driver'))
objects += SConscript('src/platform/' + platform + '/SConscript', objects += SConscript(join(join('src/platform', platform), 'SConscript'),
exports = {'symbols' : all_syms, 'env' : env,'platform' : platform}, duplicate=0, exports = { 'env' : env }, duplicate = 0,
build_dir=builddir + 'platform' + '/' +platform) build_dir = join(builddir, join('platform', platform)))
kernel_elf = env.Program(BUILDDIR + '/kernel.elf', objects)
#env_phys = env.Clone()
#env_phys.Replace(LINKFLAGS = ['-nostdlib', '-T' + join(builddir, 'include/physlink.lds')])
#env_phys.Program(BUILDDIR + '/kernel_phys.elf', objects)
Alias('kernel', kernel_elf) # Add builders for generating kernel linker scripts
Depends(kernel_elf, objects) kernel_linker = Builder(action = generate_kernel_linker_script)
Depends(objects, create_kernel_linker) env.Append(BUILDERS = {'KERNEL_LINKER' : kernel_linker})
#Depends(objects, create_kernel_phys_linker) env.KERNEL_LINKER(join(builddir, 'include/l4/arch/arm/linker.lds'),
Depends(objects, 'include/l4/config.h') [join(PROJROOT, 'include/l4/arch/arm/linker.lds.in'), CONFIG_H])
'''
kernel_phys_linker = Builder(action = generate_kernel_phys_linker_script)
env_phys = env.Clone()
env_phys.Replace(LINKFLAGS = ['-nostdlib', '-T' + join(builddir, 'include/physlink.lds')])
env_phys.Append(BUILDERS = {'KERNEL_LINKER' : kernel_phys_linker})
env_phys.KERNEL_LINKER(join(builddir, 'include/physlink.lds'),
join(PROJROOT, 'include/l4/arch/arm/linker.lds.in'), CONFIG_H)
kernel_phys_elf = env_phys.Program(join(BUILDDIR, 'kernel_phys.elf'), objects)
Depends(kernel_phys_elf, objects)
'''
kernel_elf = env.Program(KERNEL_ELF, objects)
Depends(objects, CONFIG_H)

View File

@@ -1,64 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
#
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
import os, sys, shelve
from os.path import join
from config.configuration import *
from config.projpaths import *
config = configuration_retrieve()
arch = config.arch
platform = config.platform
gcc_arch_flag = config.gcc_arch_flag
variant = 'baremetal'
# Locally important paths are here
LIBC_PATH = 'loader/libs/c'
LIBC_LIBPATH = LIBC_PATH
LIBC_INCPATH = ['#' + join(LIBC_PATH, 'include'), \
'#' + join(LIBC_PATH, 'include/arch/' + arch)]
LIBDEV_PATH = 'conts/libdev'
LIBDEV_INCPATH = ['#' + join(LIBDEV_PATH, 'include'),]
LIBELF_PATH = 'loader/libs/elf'
LIBELF_LIBPATH = LIBELF_PATH
LIBELF_INCPATH = '#' + join(LIBELF_PATH, 'include')
env = Environment(CC = config.toolchain_kernel + 'gcc',
AR = config.toolchain_kernel + 'ar',
RANLIB = config.toolchain_kernel + 'ranlib',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
'-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + join(BUILDDIR, 'loader/linker.lds'), "-u_start"],
ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf',
ENV = {'PATH' : os.environ['PATH']},
LIBS = ['gcc', 'elf', 'libdev-baremetal', 'c-baremetal', 'gcc'],
LIBPATH = [join(join('build', LIBDEV_PATH), 'sys-' + variant), \
join('build', LIBELF_PATH), join('build', LIBC_PATH)],
CPPPATH = ['#include', LIBDEV_INCPATH, LIBC_INCPATH, LIBELF_INCPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h -D__KERNEL__')
libdev = SConscript('conts/libdev/SConscript', \
exports = { 'env' : env, 'arch' : arch, 'platform' : platform, 'type' : variant}, \
duplicate = 0, variant_dir = 'build/conts/libdev/sys-' + variant)
libc = SConscript('loader/libs/c/SConscript', \
exports = { 'env' : env, 'arch' : arch, 'platform' : platform, 'type' : variant}, \
duplicate = 0, variant_dir = 'build/loader/libs/c')
libelf = SConscript('loader/libs/elf/SConscript', exports = { 'env' : env }, \
duplicate = 0, variant_dir = 'build/loader/libs/elf')
loader_objs = SConscript('loader/SConscript', exports = { 'env' : env }, \
duplicate = 0, variant_dir = 'build/loader')
final_elf = env.Program('build/final.elf', [libelf + libc + loader_objs])
Depends(loader_objs, libelf)
Depends(loader_objs, libc)

View File

@@ -1,59 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
#
# Codezero -- Virtualization microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
import os, shelve
import configure
from configure import *
from os.path import *
config = configuration_retrieve()
arch = config.arch
subarch = config.subarch
platform = config.platform
gcc_arch_flag = config.gcc_arch_flag
all_syms = config.all
env = Environment(CC = config.toolchain_userspace + 'gcc',
AR = config.toolchain_userspace + 'ar',
RANLIB = config.toolchain_userspace + 'ranlib',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__', '-march=' + gcc_arch_flag],
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = 'gcc', # libgcc.a - This is required for division routines.
CPPPATH = "#include",
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
libl4 = SConscript('conts/libl4/SConscript', \
exports = { 'env' : env, 'arch' : arch, 'subarch' : subarch }, duplicate = 0, \
variant_dir = join(BUILDDIR, os.path.relpath('conts/libl4', PROJROOT)))
e = env.Clone()
e.Replace(CPPFLAGS = '')
type = 'userspace'
libdev = SConscript('conts/libdev/SConscript', \
exports = { 'env' : e, 'arch' : arch, 'platform' : platform, 'type' : 'userspace' }, \
duplicate = 0, variant_dir = \
join(join(BUILDDIR, os.path.relpath('conts/libdev', PROJROOT)), 'sys-' + type))
libc = SConscript('conts/libc/SConscript', \
exports = { 'env' : env, 'arch' : arch, 'type' : 'userspace' }, \
duplicate = 0, variant_dir = \
join(BUILDDIR, os.path.relpath('conts/libc', PROJROOT)))
libmm, libmc, libmalloc = SConscript('conts/libmem/SConscript', \
exports = { 'env' : env, }, duplicate = 0, variant_dir = \
join(BUILDDIR, os.path.relpath('conts/libmem', PROJROOT)))
Alias('libl4', libl4)
Alias('libdev', libdev)
Alias('libc', libc)
Alias('libmm', libmm)
Alias('libmc', libmc)
Alias('libmalloc', libmalloc)

178
build.py
View File

@@ -9,75 +9,127 @@
# #
import os, sys, shelve, shutil import os, sys, shelve, shutil
from os.path import join from os.path import join
from config.projpaths import * from scripts.config.projpaths import *
from config.configuration import * from scripts.config.configuration import *
from config.config_check import * from scripts.config.config_check import *
from scripts.qemu import qemu_cmdline from scripts.qemu.qemu_cmdline import *
from scripts.conts import containers from scripts.conts import containers
from configure import * from scripts.config.config_invoke import *
from scripts.kernel.check_kernel_limit import *
def build_system(opts, args):
if opts.print_config:
config = configuration_retrieve()
if config:
config.config_print()
else:
print '\nNo configuration to print...\n'
return None
# Configure
configure_system(opts, args)
# Are we asked to configure only
if opts.config_only:
return None
# Check for sanity of containers
sanity_check_conts()
# Build userspace libraries
os.chdir(USERLIBS_DIR)
print "\nBuilding userspace libraries..."
ret = os.system("scons" + " -j " + opts.jobs)
if(ret):
print "Building userspace libraries failed...\n"
sys.exit(1)
# Build containers
os.chdir(PROJROOT)
print "\nBuilding containers..."
containers.build_all_containers(opts)
# Build the kernel
print "\nBuilding the kernel..."
os.chdir(PROJROOT)
ret = os.system("scons" + " -j " + opts.jobs)
if(ret):
print "Building kernel failed...\n"
sys.exit(1)
# Check if kernel overlap with first container
if(check_kernel_container_overlap()):
print "Kernel overlaps with first continer."
print "Please shift the first container to some higher " + \
"address after the kernel and build again...\n"
sys.exit(1)
# Build the loader
os.chdir(PROJROOT)
print "\nBuilding the loader and packing..."
ret = os.system("scons -f " + join(LOADERDIR, 'SConstruct') + " -j " + opts.jobs)
if(ret):
print "Building loader failed...\n"
sys.exit(1)
# Build qemu-insight-script
print "\nBuilding qemu-insight-script..."
build_qemu_cmdline_script()
print "\nBuild complete..."
print "\nRun qemu with following command: ./tools/run-qemu-insight\n"
renamed_cml = rename_config_cml(opts)
if(renamed_cml):
print 'CML configuration file saved as ' + renamed_cml + '\n'
return None
def clean_system(opts):
# Clean only if some config exists.
if not configuration_retrieve():
print '\nNo configuration exists, nothing to clean..\n'
return None
# Clean userspace libraries
os.chdir(USERLIBS_DIR)
print "\nCleaning userspace libraries..."
ret = os.system("scons -c")
# Clean containers
os.chdir(PROJROOT)
print "\nCleaning containers..."
containers.clean_all_containers()
# Clean the kernel
print "\nCleaning the kernel..."
os.chdir(PROJROOT)
ret = os.system("scons -c")
# Clean the loader
os.chdir(PROJROOT)
print "\nCleaning the loader..."
ret = os.system("scons -c -f " + join(LOADERDIR, 'SConstruct'))
# Remove qemu-insight-script
print "\nRemoving qemu-insight-script..."
clean_qemu_cmdline_script()
if opts.clean_all:
cml_files_cleanup()
print '\nCleaning Done...\n'
return None
def main(): def main():
opts, args = build_parse_options() opts, args = build_parse_options()
#
# Configure
#
configure_system(opts, args)
# if opts.clean or opts.clean_all:
# Check for sanity of containers clean_system(opts)
# else:
sanity_check_conts() build_system(opts, args)
# return None
# Build userspace libraries
#
print "\nBuilding userspace libraries..."
ret = os.system('scons -f SConstruct.userlibs')
if(ret):
print "Build failed \n"
sys.exit(1)
#
# Build containers
#
print "\nBuilding containers..."
containers.build_all_containers()
#
# Generate cinfo
#
generate_cinfo()
#
# Build the kernel
#
print "\nBuilding the kernel..."
os.chdir(PROJROOT)
ret = os.system("scons")
if(ret):
print "Build failed \n"
sys.exit(1)
#
# Build libs and loader
#
os.chdir(PROJROOT)
print "\nBuilding the loader and packing..."
ret = os.system("scons -f SConstruct.loader")
if(ret):
print "Build failed \n"
sys.exit(1)
#
# Build qemu-insight-script
#
print "\nBuilding qemu-insight-script.."
qemu_cmdline.build_qemu_cmdline_script()
#build_qemu_cmdline_script()
print "\nBuild complete."
print "\nRun qemu with following command: ./tools/run-qemu-insight\n"
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@@ -1,273 +0,0 @@
#! /usr/bin/env python2.6
# -*- mode: python; coding: utf-8; -*-
import os, sys, shelve, shutil, re
from projpaths import *
from lib import *
from caps import *
from string import Template
cap_strings = { 'ipc' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_IPC | ${target_rtype},
\t\t\t\t.access = CAP_IPC_SEND | CAP_IPC_RECV
\t\t\t\t | CAP_IPC_FULL | CAP_IPC_SHORT
\t\t\t\t | CAP_IPC_EXTENDED | CAP_CHANGEABLE
\t\t\t\t | CAP_REPLICABLE | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0, .size = 0,
\t\t\t},
'''
, 'tctrl' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_TCTRL | ${target_rtype},
\t\t\t\t.access = CAP_TCTRL_CREATE | CAP_TCTRL_DESTROY
\t\t\t\t | CAP_TCTRL_SUSPEND | CAP_TCTRL_RUN
\t\t\t\t | CAP_TCTRL_RECYCLE | CAP_TCTRL_WAIT
\t\t\t\t | CAP_CHANGEABLE | CAP_REPLICABLE
\t\t\t\t | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0, .size = 0,
\t\t\t},
'''
, 'irqctrl' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_IRQCTRL | ${target_rtype},
\t\t\t\t.access = CAP_IRQCTRL_REGISTER | CAP_IRQCTRL_WAIT
\t\t\t\t | CAP_CHANGEABLE | CAP_REPLICABLE
\t\t\t\t | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0, .size = 0,
\t\t\t},
'''
, 'exregs' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_EXREGS | ${target_rtype},
\t\t\t\t.access = CAP_EXREGS_RW_PAGER
\t\t\t\t | CAP_EXREGS_RW_UTCB | CAP_EXREGS_RW_SP
\t\t\t\t | CAP_EXREGS_RW_PC | CAP_EXREGS_RW_REGS
\t\t\t\t | CAP_CHANGEABLE | CAP_REPLICABLE | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0, .size = 0,
\t\t\t},
'''
, 'capctrl' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_CAP | ${target_rtype},
\t\t\t\t.access = CAP_CAP_GRANT | CAP_CAP_READ
\t\t\t\t | CAP_CAP_SHARE | CAP_CAP_REPLICATE
\t\t\t\t | CAP_CAP_MODIFY
\t\t\t\t| CAP_CAP_READ | CAP_CAP_SHARE,
\t\t\t\t.start = 0, .end = 0, .size = 0,
\t\t\t},
'''
, 'umutex' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_UMUTEX | CAP_RTYPE_CONTAINER,
\t\t\t\t.access = CAP_UMUTEX_LOCK | CAP_UMUTEX_UNLOCK,
\t\t\t\t.start = 0, .end = 0, .size = 0,
\t\t\t},
'''
, 'threadpool' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_QUANTITY
\t\t\t\t | CAP_RTYPE_THREADPOOL,
\t\t\t\t.access = CAP_CHANGEABLE | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0,
\t\t\t\t.size = ${size},
\t\t\t},
'''
, 'spacepool' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_QUANTITY | CAP_RTYPE_SPACEPOOL,
\t\t\t\t.access = CAP_CHANGEABLE | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0,
\t\t\t\t.size = ${size},
\t\t\t},
'''
, 'cpupool' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_QUANTITY | CAP_RTYPE_CPUPOOL,
\t\t\t\t.access = 0, .start = 0, .end = 0,
\t\t\t\t.size = ${size} /* Percentage */,
\t\t\t},
'''
, 'mutexpool' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_QUANTITY | CAP_RTYPE_MUTEXPOOL,
\t\t\t\t.access = CAP_CHANGEABLE | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0,
\t\t\t\t.size = ${size},
\t\t\t},
'''
, 'mappool' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t/* For pmd accounting */
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_QUANTITY | CAP_RTYPE_MAPPOOL,
\t\t\t\t.access = CAP_CHANGEABLE | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0,
\t\t\t\t/* Function of mem regions, nthreads etc. */
\t\t\t\t.size = ${size},
\t\t\t},
'''
, 'cappool' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t/* For cap spliting, creating, etc. */
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_QUANTITY | CAP_RTYPE_CAPPOOL,
\t\t\t\t.access = CAP_CHANGEABLE | CAP_TRANSFERABLE,
\t\t\t\t.start = 0, .end = 0,
\t\t\t\t/* This may be existing caps X 2 etc. */
\t\t\t\t.size = ${size},
\t\t\t},
'''
, 'device' : \
'''
\t\t\t[${idx}] = {
\t\t\t\t/* For device selection */
\t\t\t\t.target = ${cid},
\t\t\t\t.type = CAP_TYPE_MAP_PHYSMEM | CAP_RTYPE_CONTAINER,
\t\t\t\t.access = CAP_MAP_READ | CAP_MAP_WRITE | CAP_MAP_EXEC |
\t\t\t\t\tCAP_MAP_CACHED | CAP_MAP_UNCACHED | CAP_MAP_UNMAP |
\t\t\t\t\tCAP_IRQCTRL_REGISTER,
\t\t\t\t.start = __pfn(PLATFORM_${devname}_BASE),
\t\t\t\t.end = __pfn(PLATFORM_${devname}_BASE + PLATFORM_${devname}_SIZE),
\t\t\t\t.size = PLATFORM_${devname}_SIZE >> 12,
\t\t\t\t.attr = (CAP_DEVTYPE_${devtype} & CAP_DEVTYPE_MASK)
\t\t\t\t\t| ((${devnum} << CAP_DEVNUM_SHIFT) & CAP_DEVNUM_MASK),
\t\t\t\t.irq = IRQ_${devname},
\t\t\t},
'''
}
#
# These are carefully crafted functions, touch with care.
#
def prepare_custom_capability(cont, param, val):
if 'TYPE' in param:
capkey, captype, rest = param.split('_', 2)
capkey = capkey.lower()
captype = captype.lower()
cont.caps[capkey] = cap_strings[captype]
elif 'TARGET' in param:
target_parts = param.split('_', 2)
if len(target_parts) == 2:
capkey = target_parts[0].lower()
templ = Template(cont.caps[capkey])
cont.caps[capkey] = templ.safe_substitute(cid = val)
elif len(target_parts) == 3:
capkey = target_parts[0].lower()
ttype = target_parts[2]
templ = Template(cont.caps[capkey])
# On current container, provide correct rtype and current containerid.
# Else we leave container id to user-supplied value
if ttype == 'CURRENT_CONTAINER':
cont.caps[capkey] = templ.safe_substitute(target_rtype = 'CAP_RTYPE_CONTAINER',
cid = cont.id)
elif ttype == 'CURRENT_PAGER_SPACE':
cont.caps[capkey] = templ.safe_substitute(target_rtype = 'CAP_RTYPE_SPACE',
cid = cont.id)
elif ttype == 'ANOTHER_CONTAINER':
cont.caps[capkey] = templ.safe_substitute(target_rtype = 'CAP_RTYPE_CONTAINER')
elif ttype == 'ANOTHER_PAGER':
cont.caps[capkey] = templ.safe_substitute(target_rtype = 'CAP_RTYPE_THREAD')
elif 'DEVICE' in param:
# Extract all fields
unused, device_name, rest = param.split('_', 2)
capkey = device_name.lower()
cont.caps[capkey] = cap_strings['device']
templ = Template(cont.caps[capkey])
device_id = device_name[-1:]
device_type = device_name[:-1]
# Fill in all blanks
cont.caps[capkey] = \
templ.safe_substitute(cid = cont.id,
devname = device_name,
devnum = device_id,
devtype = device_type)
else: # Ignore custom_use symbol
return
# print capkey
# print cont.caps[capkey]
def prepare_typed_capability(cont, param, val):
captype, params = param.split('_', 1)
captype = captype.lower()
# USE makes us assign the initial cap string with blank fields
if 'USE' in params:
cont.caps[captype] = cap_strings[captype]
# Prepare string template from capability type
templ = Template(cont.caps[captype])
# If it is a pool, amend current container id as default
if captype[-len('pool'):] == 'pool':
cont.caps[captype] = templ.safe_substitute(cid = cont.id)
# Fill in the blank size field
elif 'SIZE' in params:
# Get reference to capability string template
templ = Template(cont.caps[captype])
cont.caps[captype] = templ.safe_substitute(size = val)
# Fill in capability target type and target id fields
elif 'TARGET' in params:
# Get reference to capability string template
templ = Template(cont.caps[captype])
# Two types of strings are expected here: TARGET or TARGET_TARGETTYPE
# If TARGET, the corresponding value is in val
target_parts = params.split('_', 1)
# Target type
if len(target_parts) == 2:
ttype = target_parts[1]
# On current container, provide correct rtype and current containerid.
# Else we leave container id to user-supplied value
if ttype == 'CURRENT_CONTAINER':
cont.caps[captype] = templ.safe_substitute(target_rtype = 'CAP_RTYPE_CONTAINER',
cid = cont.id)
elif ttype == 'CURRENT_PAGER_SPACE':
cont.caps[captype] = templ.safe_substitute(target_rtype = 'CAP_RTYPE_SPACE',
cid = cont.id)
elif ttype == 'ANOTHER_CONTAINER':
cont.caps[captype] = templ.safe_substitute(target_rtype = 'CAP_RTYPE_CONTAINER')
elif ttype == 'ANOTHER_PAGER':
cont.caps[captype] = templ.safe_substitute(target_rtype = 'CAP_RTYPE_THREAD')
# Get target value supplied by user in val
else:
cont.caps[captype] = templ.safe_substitute(cid = val)
#print captype
#print cont.caps[captype]
def prepare_capability(cont, param, val):
if 'CUSTOM' in param or 'DEVICE' in param:
prepare_custom_capability(cont, param, val)
else:
prepare_typed_capability(cont, param, val)

View File

@@ -1,213 +0,0 @@
start main_menu
#############
# SYMBOLS #
#############
symbols
ARCH_ARM 'ARM'
arm_cpu_type 'ARM Processor Type'
CPU_ARM1136 'ARM1136 - Experimental'
CPU_ARM11MPCORE 'ARM11 MPCore - Experimental'
CPU_ARM926 'ARM926EJ-S'
CPU_CORTEXA8 'ARM Cortex-A8'
CPU_CORTEXA9 'ARM Cortex-A9'
arm_platform_type 'ARM Platform Type'
PLATFORM_EB 'Realview EB Platform'
PLATFORM_PBA8 'Realview PB-A8 Platform, To be added'
PLATFORM_PB926 'Versatile PB926 Platform'
PLATFORM_PB11MPCORE 'Realview PB11MPCore Platform'
PLATFORM_BEAGLE 'OMAP3530/Cortex-A8 Beagle Board'
PLATFORM_PBA9 'Realview Express Cortex-A9'
main_menu 'Codezero Microkernel Configurator'
arm_menu 'ARM Architecture Configuration'
arm_cpu_menu 'ARM CPU type'
arm_platform_menu 'ARM Platform Type'
processor_properties 'Generic Processor Properties'
kernel_generic_options 'Generic Kernel Properties'
toolchain_menu 'Toolchain Prefix'
containers_menu 'Container Setup'
arch_type 'Main architecture'
SMP 'Enable SMP Support'
NCPU 'Number of SMP CPUs'
DEBUG_ACCOUNTING 'Enable system operations accounting'
DEBUG_PERFMON 'Enable performance monitoring'
DEBUG_PERFMON_USER 'Userspace access to perfmon registers (in-kernel measurements disabled)'
DEBUG_SPINLOCKS 'Debug spinlocks, e.g. detect recursive locks, double unlocks'
SCHED_TICKS 'Scheduler ticks per second'
ICACHE_DISABLE 'Disable the L1 instruction cache'
DCACHE_DISABLE 'Disable the L1 data cache'
PREEMPT_DISABLE 'Disable Kernel Preemption'
TOOLCHAIN_USERSPACE 'Toolchain prefix for userspace'
TOOLCHAIN_KERNEL 'Toolchain prefix for kernel'
CAPABILITIES 'Enable capability checking'
#############
# CHOICES #
#############
choices arch_type
ARCH_ARM
default ARCH_ARM
choices arm_platform_type
PLATFORM_EB
PLATFORM_PBA8
PLATFORM_PB926
PLATFORM_PB11MPCORE
PLATFORM_BEAGLE
PLATFORM_PBA9
default PLATFORM_PB926
choices arm_cpu_type
CPU_ARM926
CPU_ARM1136
CPU_ARM11MPCORE
CPU_CORTEXA8
CPU_CORTEXA9
default CPU_ARM926
#############
# MENUS #
#############
menu arm_cpu_menu
arm_cpu_type
menu arm_platform_menu
arm_platform_type
menu arm_menu
arm_platform_menu
arm_cpu_menu
menu processor_properties
SMP
NCPU%
ICACHE_DISABLE
DCACHE_DISABLE
menu kernel_generic_options
PREEMPT_DISABLE
DEBUG_ACCOUNTING
DEBUG_PERFMON
DEBUG_PERFMON_USER
DEBUG_SPINLOCKS
SCHED_TICKS%
menu toolchain_menu
TOOLCHAIN_USERSPACE$
TOOLCHAIN_KERNEL$
menu main_menu
arch_type
arm_menu
processor_properties
kernel_generic_options
toolchain_menu
containers_menu
#############
# RULES #
#############
#Capability/Container rules:
default CAPABILITIES from y
default DEBUG_ACCOUNTING from n
default DEBUG_PERFMON from n
default DEBUG_PERFMON_USER from n
default DEBUG_SPINLOCKS from n
default SCHED_TICKS from 1000
derive DEBUG_PERFMON_KERNEL from DEBUG_PERFMON == y and DEBUG_PERFMON_USER != y
#Subarch Derivation Rules
derive SUBARCH_V5 from CPU_ARM926
derive SUBARCH_V6 from CPU_ARM1136 or
CPU_ARM11MPCORE
derive SUBARCH_V7 from CPU_CORTEXA8 or
CPU_CORTEXA9
#CPU rules:
unless PLATFORM_PB926 suppress CPU_ARM926
unless PLATFORM_PB11MPCORE or PLATFORM_EB suppress CPU_ARM11MPCORE
unless PLATFORM_EB suppress CPU_ARM1136
unless PLATFORM_PBA9 or PLATFORM_EB suppress CPU_CORTEXA9
unless PLATFORM_BEAGLE or
PLATFORM_PBA8 or
PLATFORM_EB suppress CPU_CORTEXA8
#SMP support rules
unless CPU_CORTEXA9 or CPU_ARM11MPCORE suppress SMP
unless CPU_CORTEXA9 or CPU_ARM11MPCORE suppress NCPU
unless SMP suppress NCPU
unless DEBUG_ACCOUNTING suppress DEBUG_PERFMON
DEBUG_PERFMON_USER
unless DEBUG_PERFMON suppress DEBUG_PERFMON_USER
# NOTE: Unlike menus, choices dont take { sym } model of visibility
# dependencies. Instead, a choice symbol is declared in a menu, and
# suppress statement is used to make sym visible, instead of a
# { sym } model under the choices. (See manual for { sym } usage).
unless ARCH_ARM suppress arm_menu
derive DRIVER_UART_PL011 from PLATFORM_PB926 or
PLATFORM_PB11MPCORE or
PLATFORM_PBA9 or
PLATFORM_EB or
PLATFORM_PBA8
derive DRIVER_TIMER_SP804 from PLATFORM_PB926 or
PLATFORM_PB11MPCORE or
PLATFORM_PBA9 or
PLATFORM_EB or
PLATFORM_PBA8
derive DRIVER_IRQ_PL190 from PLATFORM_PB926
derive DRIVER_IRQ_GIC from PLATFORM_PB11MPCORE or
PLATFORM_PBA9 or
PLATFORM_EB or
PLATFORM_PBA8
derive DRIVER_UART_OMAP from PLATFORM_BEAGLE
derive DRIVER_TIMER_OMAP from PLATFORM_BEAGLE
derive DRIVER_INTC_OMAP from PLATFORM_BEAGLE
#SMP default value
default SMP from y
default NCPU from 4
default ICACHE_DISABLE from n
default DCACHE_DISABLE from n
default PREEMPT_DISABLE from n
require NCPU <= 4
# Derive Ram base address depending on platform selected
# we use this in setting containers physical regions
# default values
# FIXME: Find a better solution
derive RAM_BASE_PLAT from PLATFORM_BEAGLE ? 0x80000000 : 0x00000000
# Toolchains:
default TOOLCHAIN_USERSPACE from 'arm-none-linux-gnueabi-'
default TOOLCHAIN_KERNEL from 'arm-none-eabi-'
prefix CONFIG_
# Checklist for correct CML2
# 1) Have you defined a prompt for each menu, choice_type?
# 2) Have you defined a default for each symbol?
# 3) Have you put 'symbols' keyword before each symbol, menu and choice?
# Important note on derived symbols
# DO NOT place any declaration for derived symbols like normal symbols,
# otherwise the derivation will be silently ignored, and you will be left
# wondering why.

View File

@@ -1,749 +0,0 @@
symbols
CONT%(cn)d_TYPE_LINUX 'Linux Container'
CONT%(cn)d_TYPE_BAREMETAL 'Baremetal Container'
CONT%(cn)d_TYPE_POSIX 'POSIX Container'
CONT%(cn)d_OPT_NAME 'Container Name'
CONTAINERS 'Number of containers'
CONT%(cn)d_PHYSMEM_REGIONS 'Container %(cn)d Number of Physical Regions'
CONT%(cn)d_PHYS0_START 'Container %(cn)d Physical Region 0 Start Address'
CONT%(cn)d_PHYS0_END 'Container %(cn)d Physical Region 0 End Address'
CONT%(cn)d_PHYS1_START 'Container %(cn)d Physical Region 1 Start Address'
CONT%(cn)d_PHYS1_END 'Container %(cn)d Physical Region 1 End Address'
CONT%(cn)d_PHYS2_START 'Container %(cn)d Physical Region 2 Start Address'
CONT%(cn)d_PHYS2_END 'Container %(cn)d Physical Region 2 End Address'
CONT%(cn)d_PHYS3_START 'Container %(cn)d Physical Region 3 Start Address'
CONT%(cn)d_PHYS3_END 'Container %(cn)d Physical Region 3 End Address'
symbols
CONT%(cn)d_VIRTMEM_REGIONS 'Container %(cn)d Number of Virtual Regions'
CONT%(cn)d_VIRT0_START 'Container %(cn)d Virtual Region 0 Start Address'
CONT%(cn)d_VIRT0_END 'Container %(cn)d Virtual Region 0 End Address'
CONT%(cn)d_VIRT1_START 'Container %(cn)d Virtual Region 1 Start Address'
CONT%(cn)d_VIRT1_END 'Container %(cn)d Virtual Region 1 End Address'
CONT%(cn)d_VIRT2_START 'Container %(cn)d Virtual Region 2 Start Address'
CONT%(cn)d_VIRT2_END 'Container %(cn)d Virtual Region 2 End Address'
CONT%(cn)d_VIRT3_START 'Container %(cn)d Virtual Region 3 Start Address'
CONT%(cn)d_VIRT3_END 'Container %(cn)d Virtual Region 3 End Address'
CONT%(cn)d_VIRT4_START 'Container %(cn)d Virtual Region 4 Start Address'
CONT%(cn)d_VIRT4_END 'Container %(cn)d Virtual Region 4 End Address'
CONT%(cn)d_VIRT5_START 'Container %(cn)d Virtual Region 5 Start Address'
CONT%(cn)d_VIRT5_END 'Container %(cn)d Virtual Region 5 End Address'
# FIXME: We dont need to pass PAGER_LMA and PAGER_VMA to config.h now
# as we are using them just to derive other symbols, in this file only
CONT%(cn)d_PAGER_LMA 'Container %(cn)d Pager LMA'
CONT%(cn)d_PAGER_VMA 'Container %(cn)d Pager VMA'
CONT%(cn)d_PAGER_SHM_START 'Container %(cn)d Shared Mappings Region Start'
CONT%(cn)d_PAGER_SHM_END 'Container %(cn)d Shared Mappings Region End'
CONT%(cn)d_PAGER_TASK_START 'Container %(cn)d Task Address Space Region Start'
CONT%(cn)d_PAGER_TASK_END 'Container %(cn)d Task Address Space Region End'
CONT%(cn)d_PAGER_UTCB_START 'Container %(cn)d UTCB Mappings Region Start'
CONT%(cn)d_PAGER_UTCB_END 'Container %(cn)d UTCB Mappings Region End'
CONT%(cn)d_LINUX_ZRELADDR 'Container %(cn)d Linux ZRELADDR Parameter'
CONT%(cn)d_LINUX_PAGE_OFFSET 'Container %(cn)d Linux PAGE_OFFSET Parameter'
CONT%(cn)d_LINUX_PHYS_OFFSET 'Container %(cn)d Linux PHYS_OFFSET Parameter'
CONT%(cn)d_LINUX_ROOTFS_ADDRESS 'Container %(cn)d Linux ROOTFS Address'
default CONT%(cn)d_PAGER_LMA from CONT%(cn)d_PHYS0_START
default CONT%(cn)d_PAGER_VMA from CONT%(cn)d_VIRT0_START
default CONT%(cn)d_PAGER_SHM_START from CONT%(cn)d_VIRT1_START
default CONT%(cn)d_PAGER_SHM_END from CONT%(cn)d_VIRT1_END
default CONT%(cn)d_PAGER_TASK_START from CONT%(cn)d_VIRT2_START
default CONT%(cn)d_PAGER_TASK_END from CONT%(cn)d_VIRT2_END
default CONT%(cn)d_PAGER_UTCB_START from CONT%(cn)d_VIRT3_START
default CONT%(cn)d_PAGER_UTCB_END from CONT%(cn)d_VIRT3_END
default CONT%(cn)d_LINUX_ZRELADDR from (CONT%(cn)d_LINUX_PHYS_OFFSET + 0x8000)
default CONT%(cn)d_LINUX_PAGE_OFFSET from CONT%(cn)d_VIRT0_START
default CONT%(cn)d_LINUX_PHYS_OFFSET from CONT%(cn)d_PHYS0_START
default CONT%(cn)d_LINUX_ROOTFS_ADDRESS from (CONT%(cn)d_LINUX_PHYS_OFFSET + 0x500000)
default CONT%(cn)d_VIRTMEM_REGIONS from (CONT%(cn)d_TYPE_POSIX==y ? 4 : 1)
default CONT%(cn)d_PHYSMEM_REGIONS from 1
# Define limits on virtual and physical memory regions of a _single_ container 0. Too much code!
when CONT%(cn)d_VIRTMEM_REGIONS < 2 suppress CONT%(cn)d_VIRT1_START CONT%(cn)d_VIRT1_END
when CONT%(cn)d_VIRTMEM_REGIONS < 2 suppress CONT%(cn)d_VIRT2_START CONT%(cn)d_VIRT2_END
when CONT%(cn)d_VIRTMEM_REGIONS < 2 suppress CONT%(cn)d_VIRT3_START CONT%(cn)d_VIRT3_END
when CONT%(cn)d_VIRTMEM_REGIONS < 2 suppress CONT%(cn)d_VIRT4_START CONT%(cn)d_VIRT4_END
when CONT%(cn)d_VIRTMEM_REGIONS < 2 suppress CONT%(cn)d_VIRT5_START CONT%(cn)d_VIRT5_END
when CONT%(cn)d_VIRTMEM_REGIONS < 3 suppress CONT%(cn)d_VIRT2_START CONT%(cn)d_VIRT2_END
when CONT%(cn)d_VIRTMEM_REGIONS < 3 suppress CONT%(cn)d_VIRT3_START CONT%(cn)d_VIRT3_END
when CONT%(cn)d_VIRTMEM_REGIONS < 3 suppress CONT%(cn)d_VIRT4_START CONT%(cn)d_VIRT4_END
when CONT%(cn)d_VIRTMEM_REGIONS < 3 suppress CONT%(cn)d_VIRT5_START CONT%(cn)d_VIRT5_END
when CONT%(cn)d_VIRTMEM_REGIONS < 4 suppress CONT%(cn)d_VIRT3_START CONT%(cn)d_VIRT3_END
when CONT%(cn)d_VIRTMEM_REGIONS < 4 suppress CONT%(cn)d_VIRT4_START CONT%(cn)d_VIRT4_END
when CONT%(cn)d_VIRTMEM_REGIONS < 4 suppress CONT%(cn)d_VIRT5_START CONT%(cn)d_VIRT5_END
when CONT%(cn)d_VIRTMEM_REGIONS < 5 suppress CONT%(cn)d_VIRT4_START CONT%(cn)d_VIRT4_END
when CONT%(cn)d_VIRTMEM_REGIONS < 5 suppress CONT%(cn)d_VIRT5_START CONT%(cn)d_VIRT5_END
when CONT%(cn)d_VIRTMEM_REGIONS < 6 suppress CONT%(cn)d_VIRT5_START CONT%(cn)d_VIRT5_END
when CONT%(cn)d_PHYSMEM_REGIONS < 2 suppress CONT%(cn)d_PHYS1_START CONT%(cn)d_PHYS1_END
when CONT%(cn)d_PHYSMEM_REGIONS < 2 suppress CONT%(cn)d_PHYS2_START CONT%(cn)d_PHYS2_END
when CONT%(cn)d_PHYSMEM_REGIONS < 2 suppress CONT%(cn)d_PHYS3_START CONT%(cn)d_PHYS3_END
when CONT%(cn)d_PHYSMEM_REGIONS < 3 suppress CONT%(cn)d_PHYS2_START CONT%(cn)d_PHYS2_END
when CONT%(cn)d_PHYSMEM_REGIONS < 3 suppress CONT%(cn)d_PHYS3_START CONT%(cn)d_PHYS3_END
when CONT%(cn)d_PHYSMEM_REGIONS < 4 suppress CONT%(cn)d_PHYS3_START CONT%(cn)d_PHYS3_END
# We assume kernel uses 0x0 - 0x40000 physical RAM.
# Physical Regions for containers should start after kernel.
require CONT%(cn)d_PHYS0_START >= 0x40000
require CONT%(cn)d_PHYS1_START >= 0x40000
require CONT%(cn)d_PHYS2_START >= 0x40000
require CONT%(cn)d_PHYS3_START >= 0x40000
# TODO: We can add check for end address of physical region to be
# less than RAM SIZE, need to find out RAM SIZE?
# Rules for Linux kernel parameters
require CONT%(cn)d_LINUX_ZRELADDR > CONT%(cn)d_LINUX_PHYS_OFFSET + 0x8000
# TODO: Do we want to check if PAGER_LMA/VMA lies in allocated memory regions
default CONT%(cn)d_PHYS0_START from ((%(cn)d == 0 ? 0x100000 : (0x100000 + %(cn)d * 0x1000000)) + RAM_BASE_PLAT)
default CONT%(cn)d_PHYS0_END from (CONT%(cn)d_PHYS0_START + 0xD00000)
default CONT%(cn)d_PHYS1_START from CONT%(cn)d_PHYS0_END
default CONT%(cn)d_PHYS1_END from (CONT%(cn)d_PHYS1_START + 0x100000)
default CONT%(cn)d_PHYS2_START from CONT%(cn)d_PHYS1_END
default CONT%(cn)d_PHYS2_END from (CONT%(cn)d_PHYS2_START + 0x100000)
default CONT%(cn)d_PHYS3_START from CONT%(cn)d_PHYS2_END
default CONT%(cn)d_PHYS3_END from (CONT%(cn)d_PHYS3_START + 0x100000)
default CONT%(cn)d_VIRT0_START from (%(cn)d == 0 ? 0xa0000000 : (0xa0000000 + %(cn)d * 0x10000000))
default CONT%(cn)d_VIRT0_END from (CONT%(cn)d_VIRT0_START + 0x10000000)
default CONT%(cn)d_VIRT1_START from (%(cn)d == 0 ? 0x80000000 : (0x80000000 + %(cn)d * 0x8000000))
default CONT%(cn)d_VIRT1_END from (CONT%(cn)d_VIRT1_START + 0x8000000)
default CONT%(cn)d_VIRT2_START from (%(cn)d == 0 ? 0x40000000 : (0x40000000 + %(cn)d * 0x10000000))
default CONT%(cn)d_VIRT2_END from (CONT%(cn)d_VIRT2_START + 0x10000000)
default CONT%(cn)d_VIRT3_START from (%(cn)d == 0 ? 0xf8100000 : (0xf8100000 + %(cn)d * 0x100000))
default CONT%(cn)d_VIRT3_END from (CONT%(cn)d_VIRT3_START + 0x100000)
default CONT%(cn)d_VIRT4_START from (%(cn)d == 0 ? 0x10000000 : (0x10000000 + %(cn)d * 0x10000000))
default CONT%(cn)d_VIRT4_END from (CONT%(cn)d_VIRT4_START + 0x10000000)
default CONT%(cn)d_VIRT5_START from 0xe0000000
default CONT%(cn)d_VIRT5_END from 0xf0000000
default CONT%(cn)d_OPT_NAME from
(CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" :
((CONT%(cn)d_TYPE_POSIX==y) ? "posix%(cn)d" :
((CONT%(cn)d_BAREMETAL_PROJ_HELLO_WORLD==y) ? "hello_world%(cn)d" :
((CONT%(cn)d_BAREMETAL_PROJ_THREADS_DEMO==y) ? "thread_demo%(cn)d" :
((CONT%(cn)d_BAREMETAL_PROJ_TEST_SUITE==y) ? "test_suite%(cn)d" :
((CONT%(cn)d_BAREMETAL_PROJ_UART_SERVICE==y) ? "uart_service%(cn)d" :
((CONT%(cn)d_BAREMETAL_PROJ_KMI_SERVICE==y) ? "kmi_service%(cn)d" :
((CONT%(cn)d_BAREMETAL_PROJ_TIMER_SERVICE==y) ? "timer_service%(cn)d" : "empty%(cn)d")))))))
when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_default_pager_params
unless CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_posix_pager_params
unless CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_linux_pager_params
unless CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_baremetal_params
# derive symbols, for cinfo.c, depending on the type of container selected
derive CONT%(cn)d_PAGER_LOAD_ADDR from (CONT%(cn)d_TYPE_LINUX==y) ? CONT%(cn)d_LINUX_PHYS_OFFSET : CONT%(cn)d_PAGER_LMA
derive CONT%(cn)d_PAGER_VIRT_ADDR from (CONT%(cn)d_TYPE_LINUX==y) ? CONT%(cn)d_LINUX_PAGE_OFFSET : CONT%(cn)d_PAGER_VMA
derive CONT%(cn)d_START_PC_ADDR from (CONT%(cn)d_TYPE_LINUX != y) ? CONT%(cn)d_PAGER_VMA : (CONT%(cn)d_LINUX_PAGE_OFFSET + CONT%(cn)d_LINUX_ZRELADDR - CONT%(cn)d_LINUX_PHYS_OFFSET)
symbols
cont%(cn)d_menu 'Container %(cn)d Parameters'
cont%(cn)d_physmem_list 'Container %(cn)d Physical Memory Regions (Capabilities)'
cont%(cn)d_virtmem_list 'Container %(cn)d Virtual Memory Regions (Capabilities)'
cont%(cn)d_device_list 'Container %(cn)d Devices (Capabilities)'
container%(cn)d_type 'Container %(cn)d Type'
container%(cn)d_options 'Container %(cn)d Options'
cont%(cn)d_linux_pager_params 'Container %(cn)d Linux Pager Parameters'
cont%(cn)d_default_pager_params 'Container %(cn)d Default Pager Parameters'
cont%(cn)d_posix_pager_params 'Container %(cn)d POSIX Pager Parameters'
cont%(cn)d_baremetal_params 'Baremetal Project'
CONT%(cn)d_BAREMETAL_PROJ_EMPTY 'Empty Project'
CONT%(cn)d_BAREMETAL_PROJ_HELLO_WORLD 'Hello World'
CONT%(cn)d_BAREMETAL_PROJ_THREADS_DEMO 'Thread Library Demo'
CONT%(cn)d_BAREMETAL_PROJ_TEST_SUITE 'Microkernel Tests'
CONT%(cn)d_BAREMETAL_PROJ_UART_SERVICE 'UART Service'
CONT%(cn)d_BAREMETAL_PROJ_TIMER_SERVICE 'Timer Service'
CONT%(cn)d_BAREMETAL_PROJ_KMI_SERVICE 'Keyboard Mouse Service'
choices cont%(cn)d_baremetal_params
CONT%(cn)d_BAREMETAL_PROJ_EMPTY
CONT%(cn)d_BAREMETAL_PROJ_HELLO_WORLD
CONT%(cn)d_BAREMETAL_PROJ_THREADS_DEMO
CONT%(cn)d_BAREMETAL_PROJ_TEST_SUITE
CONT%(cn)d_BAREMETAL_PROJ_UART_SERVICE
CONT%(cn)d_BAREMETAL_PROJ_TIMER_SERVICE
CONT%(cn)d_BAREMETAL_PROJ_KMI_SERVICE
default CONT%(cn)d_BAREMETAL_PROJ_EMPTY
menu cont%(cn)d_default_pager_params
CONT%(cn)d_PAGER_LMA@
CONT%(cn)d_PAGER_VMA@
menu cont%(cn)d_posix_pager_params
CONT%(cn)d_PAGER_SHM_START@
CONT%(cn)d_PAGER_SHM_END@
CONT%(cn)d_PAGER_TASK_START@
CONT%(cn)d_PAGER_TASK_END@
CONT%(cn)d_PAGER_UTCB_START@
CONT%(cn)d_PAGER_UTCB_END@
menu cont%(cn)d_linux_pager_params
CONT%(cn)d_LINUX_PHYS_OFFSET@
CONT%(cn)d_LINUX_ZRELADDR@
CONT%(cn)d_LINUX_ROOTFS_ADDRESS@
CONT%(cn)d_LINUX_PAGE_OFFSET@
menu cont%(cn)d_virtmem_list
CONT%(cn)d_VIRTMEM_REGIONS%
CONT%(cn)d_VIRT0_START@
CONT%(cn)d_VIRT0_END@
CONT%(cn)d_VIRT1_START@
CONT%(cn)d_VIRT1_END@
CONT%(cn)d_VIRT2_START@
CONT%(cn)d_VIRT2_END@
CONT%(cn)d_VIRT3_START@
CONT%(cn)d_VIRT3_END@
CONT%(cn)d_VIRT4_START@
CONT%(cn)d_VIRT4_END@
CONT%(cn)d_VIRT5_START@
CONT%(cn)d_VIRT5_END@
menu cont%(cn)d_physmem_list
CONT%(cn)d_PHYSMEM_REGIONS%
CONT%(cn)d_PHYS0_START@
CONT%(cn)d_PHYS0_END@
CONT%(cn)d_PHYS1_START@
CONT%(cn)d_PHYS1_END@
CONT%(cn)d_PHYS2_START@
CONT%(cn)d_PHYS2_END@
CONT%(cn)d_PHYS3_START@
CONT%(cn)d_PHYS3_END@
#
# Device menu and options per container
#
# FIXME: All this is to be moved to a per-platform description file.
#
symbols
cont%(cn)d_cap_device_uart1 'Container %(cn)d UART1 Menu'
cont%(cn)d_cap_device_uart2 'Container %(cn)d UART2 Menu'
cont%(cn)d_cap_device_uart3 'Container %(cn)d UART3 Menu'
cont%(cn)d_cap_device_timer1 'Container %(cn)d TIMER23 Menu'
cont%(cn)d_cap_device_keyboard0 'Container %(cn)d KEYBOARD0 Menu'
cont%(cn)d_cap_device_mouse0 'Container %(cn)d MOUSE0 Menu'
cont%(cn)d_cap_device_clcd0 'Container %(cn)d CLCD0 Menu'
CONT%(cn)d_CAP_DEVICE_UART1_USE 'Container %(cn)d UART1 Enable'
CONT%(cn)d_CAP_DEVICE_UART2_USE 'Container %(cn)d UART2 Enable'
CONT%(cn)d_CAP_DEVICE_UART3_USE 'Container %(cn)d UART3 Enable'
CONT%(cn)d_CAP_DEVICE_TIMER1_USE 'Container %(cn)d TIMER23 Enable'
CONT%(cn)d_CAP_DEVICE_KEYBOARD0_USE 'Container %(cn)d KEYBOARD0 Enable'
CONT%(cn)d_CAP_DEVICE_MOUSE0_USE 'Container %(cn)d MOUSE0 Enable'
CONT%(cn)d_CAP_DEVICE_CLCD0_USE 'Container %(cn)d CLCD0 Enable'
default CONT%(cn)d_CAP_DEVICE_UART1_USE from n
default CONT%(cn)d_CAP_DEVICE_UART2_USE from n
default CONT%(cn)d_CAP_DEVICE_UART3_USE from n
default CONT%(cn)d_CAP_DEVICE_TIMER1_USE from n
default CONT%(cn)d_CAP_DEVICE_KEYBOARD0_USE from n
default CONT%(cn)d_CAP_DEVICE_MOUSE0_USE from n
default CONT%(cn)d_CAP_DEVICE_CLCD0_USE from n
menu cont%(cn)d_cap_device_uart1
CONT%(cn)d_CAP_DEVICE_UART1_USE
menu cont%(cn)d_cap_device_uart2
CONT%(cn)d_CAP_DEVICE_UART2_USE
menu cont%(cn)d_cap_device_uart3
CONT%(cn)d_CAP_DEVICE_UART3_USE
menu cont%(cn)d_cap_device_timer1
CONT%(cn)d_CAP_DEVICE_TIMER1_USE
menu cont%(cn)d_cap_device_keyboard0
CONT%(cn)d_CAP_DEVICE_KEYBOARD0_USE
menu cont%(cn)d_cap_device_mouse0
CONT%(cn)d_CAP_DEVICE_MOUSE0_USE
menu cont%(cn)d_cap_device_clcd0
CONT%(cn)d_CAP_DEVICE_CLCD0_USE
menu cont%(cn)d_device_list
cont%(cn)d_cap_device_uart1
cont%(cn)d_cap_device_uart2
cont%(cn)d_cap_device_uart3
cont%(cn)d_cap_device_clcd0
cont%(cn)d_cap_device_timer1
cont%(cn)d_cap_device_keyboard0
cont%(cn)d_cap_device_mouse0
#
# Settings for Custom Capabilities
#
choices cont%(cn)d_cap_custom0_type
CONT%(cn)d_CAP_CUSTOM0_IPC_TYPE
CONT%(cn)d_CAP_CUSTOM0_TCTRL_TYPE
CONT%(cn)d_CAP_CUSTOM0_EXREGS_TYPE
CONT%(cn)d_CAP_CUSTOM0_CAPCTRL_TYPE
default CONT%(cn)d_CAP_CUSTOM0_IPC_TYPE
choices cont%(cn)d_cap_custom1_type
CONT%(cn)d_CAP_CUSTOM1_IPC_TYPE
CONT%(cn)d_CAP_CUSTOM1_TCTRL_TYPE
CONT%(cn)d_CAP_CUSTOM1_EXREGS_TYPE
CONT%(cn)d_CAP_CUSTOM1_CAPCTRL_TYPE
default CONT%(cn)d_CAP_CUSTOM1_IPC_TYPE
choices cont%(cn)d_cap_custom2_type
CONT%(cn)d_CAP_CUSTOM2_IPC_TYPE
CONT%(cn)d_CAP_CUSTOM2_TCTRL_TYPE
CONT%(cn)d_CAP_CUSTOM2_EXREGS_TYPE
CONT%(cn)d_CAP_CUSTOM2_CAPCTRL_TYPE
default CONT%(cn)d_CAP_CUSTOM2_IPC_TYPE
choices cont%(cn)d_cap_custom3_type
CONT%(cn)d_CAP_CUSTOM3_IPC_TYPE
CONT%(cn)d_CAP_CUSTOM3_TCTRL_TYPE
CONT%(cn)d_CAP_CUSTOM3_EXREGS_TYPE
CONT%(cn)d_CAP_CUSTOM3_CAPCTRL_TYPE
default CONT%(cn)d_CAP_CUSTOM3_IPC_TYPE
default CONT%(cn)d_CAP_CUSTOM0_USE from n
default CONT%(cn)d_CAP_CUSTOM1_USE from n
default CONT%(cn)d_CAP_CUSTOM2_USE from n
default CONT%(cn)d_CAP_CUSTOM3_USE from n
menu cont%(cn)d_cap_custom0
CONT%(cn)d_CAP_CUSTOM0_USE
cont%(cn)d_cap_custom0_type
CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM0_TARGET%
menu cont%(cn)d_cap_custom1
CONT%(cn)d_CAP_CUSTOM1_USE
cont%(cn)d_cap_custom1_type
CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM1_TARGET%
menu cont%(cn)d_cap_custom2
CONT%(cn)d_CAP_CUSTOM2_USE
cont%(cn)d_cap_custom2_type
CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM2_TARGET%
menu cont%(cn)d_cap_custom3
CONT%(cn)d_CAP_CUSTOM3_USE
cont%(cn)d_cap_custom3_type
CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM3_TARGET%
choicegroup CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_PAGER
default CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_CONTAINER from y
choicegroup CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_PAGER
default CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_CONTAINER from y
choicegroup CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_PAGER
default CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_CONTAINER from y
choicegroup CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_PAGER
default CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_CONTAINER from y
when CONT%(cn)d_CAP_CUSTOM0_USE == n
suppress cont%(cn)d_cap_custom0_type
CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM0_TARGET
when CONT%(cn)d_CAP_CUSTOM1_USE == n
suppress cont%(cn)d_cap_custom1_type
CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM1_TARGET
when CONT%(cn)d_CAP_CUSTOM2_USE == n
suppress cont%(cn)d_cap_custom2_type
CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM2_TARGET
when CONT%(cn)d_CAP_CUSTOM3_USE == n
suppress cont%(cn)d_cap_custom3_type
CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM3_TARGET
when CONT%(cn)d_CAP_CUSTOM0_IPC_TYPE == n
suppress CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM0_TARGET
when CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_CONTAINER or
CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_PAGER_SPACE
suppress CONT%(cn)d_CAP_CUSTOM0_TARGET
when CONT%(cn)d_CAP_CUSTOM1_IPC_TYPE == n
suppress CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM1_TARGET
when CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_CONTAINER or
CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_PAGER_SPACE
suppress CONT%(cn)d_CAP_CUSTOM1_TARGET
when CONT%(cn)d_CAP_CUSTOM2_IPC_TYPE == n
suppress CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM2_TARGET
when CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_CONTAINER or
CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_PAGER_SPACE
suppress CONT%(cn)d_CAP_CUSTOM2_TARGET
when CONT%(cn)d_CAP_CUSTOM3_IPC_TYPE == n
suppress CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_CUSTOM3_TARGET
when CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_CONTAINER or
CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_PAGER_SPACE
suppress CONT%(cn)d_CAP_CUSTOM3_TARGET
default CONT%(cn)d_CAP_CUSTOM0_TARGET from 0
default CONT%(cn)d_CAP_CUSTOM1_TARGET from 0
default CONT%(cn)d_CAP_CUSTOM2_TARGET from 0
default CONT%(cn)d_CAP_CUSTOM3_TARGET from 0
# Symbols for Custom Capabilities
symbols
CONT%(cn)d_CAP_CUSTOM0_USE 'Enable this Capability'
cont%(cn)d_cap_custom0_type 'Capability Operation Type'
CONT%(cn)d_CAP_CUSTOM0_IPC_TYPE 'IPC Capability'
CONT%(cn)d_CAP_CUSTOM0_TCTRL_TYPE 'Thread Control Capability'
CONT%(cn)d_CAP_CUSTOM0_EXREGS_TYPE 'Exchange Registers Capability'
CONT%(cn)d_CAP_CUSTOM0_CAPCTRL_TYPE 'Capability Control Capability'
CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_CUSTOM0_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_CONTAINER 'Capability Targets Another Container'
CONT%(cn)d_CAP_CUSTOM0_TARGET_ANOTHER_PAGER 'Capability Targets Another Container`s Pager'
CONT%(cn)d_CAP_CUSTOM0_TARGET 'Enter Container ID'
CONT%(cn)d_CAP_CUSTOM1_USE 'Enable this Capability'
cont%(cn)d_cap_custom1_type 'Capability Operation Type'
CONT%(cn)d_CAP_CUSTOM1_IPC_TYPE 'IPC Capability'
CONT%(cn)d_CAP_CUSTOM1_TCTRL_TYPE 'Thread Control Capability'
CONT%(cn)d_CAP_CUSTOM1_EXREGS_TYPE 'Exchange Registers Capability'
CONT%(cn)d_CAP_CUSTOM1_CAPCTRL_TYPE 'Capability Control Capability'
CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_CUSTOM1_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_CONTAINER 'Capability Targets Another Container'
CONT%(cn)d_CAP_CUSTOM1_TARGET_ANOTHER_PAGER 'Capability Targets Another Container`s Pager'
CONT%(cn)d_CAP_CUSTOM1_TARGET 'Enter Container ID'
CONT%(cn)d_CAP_CUSTOM2_USE 'Enable this Capability'
cont%(cn)d_cap_custom2_type 'Capability Operation Type'
CONT%(cn)d_CAP_CUSTOM2_IPC_TYPE 'IPC Capability'
CONT%(cn)d_CAP_CUSTOM2_TCTRL_TYPE 'Thread Control Capability'
CONT%(cn)d_CAP_CUSTOM2_EXREGS_TYPE 'Exchange Registers Capability'
CONT%(cn)d_CAP_CUSTOM2_CAPCTRL_TYPE 'Capability Control Capability'
CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_CUSTOM2_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_CONTAINER 'Capability Targets Another Container'
CONT%(cn)d_CAP_CUSTOM2_TARGET_ANOTHER_PAGER 'Capability Targets Another Container`s Pager'
CONT%(cn)d_CAP_CUSTOM2_TARGET 'Enter Container ID'
CONT%(cn)d_CAP_CUSTOM3_USE 'Enable this Capability'
cont%(cn)d_cap_custom3_type 'Capability Operation Type'
CONT%(cn)d_CAP_CUSTOM3_IPC_TYPE 'IPC Capability'
CONT%(cn)d_CAP_CUSTOM3_TCTRL_TYPE 'Thread Control Capability'
CONT%(cn)d_CAP_CUSTOM3_EXREGS_TYPE 'Exchange Registers Capability'
CONT%(cn)d_CAP_CUSTOM3_CAPCTRL_TYPE 'Capability Control Capability'
CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_CUSTOM3_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_CONTAINER 'Capability Targets Another Container'
CONT%(cn)d_CAP_CUSTOM3_TARGET_ANOTHER_PAGER 'Capability Targets Another Container`s Pager'
CONT%(cn)d_CAP_CUSTOM3_TARGET 'Enter Container ID'
# Symbols for Generic Capabilities
symbols
CONT%(cn)d_CAP_TCTRL_USE 'Enable this Capability'
CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_EXREGS_USE 'Enable this Capability'
CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_IPC_USE 'Enable this Capability'
CONT%(cn)d_CAP_IPC_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_IPC_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_IPC_TARGET_ANOTHER_CONTAINER 'Capability Targets Another Container'
CONT%(cn)d_CAP_IPC_TARGET_ANOTHER_PAGER 'Capability Targets Another Container`s Pager'
CONT%(cn)d_CAP_IPC_TARGET 'Enter Container ID'
CONT%(cn)d_CAP_CAPCTRL_USE 'Enable this Capability'
CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_IRQCTRL_USE 'Enable this Capability'
CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
CONT%(cn)d_CAP_UMUTEX_USE 'Enable this Capability'
CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_CONTAINER 'Capability Targets Current Container'
CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE 'Capability Targets Current Pager`s Space'
symbols
CONT%(cn)d_CAP_THREADPOOL_SIZE 'Number of Threads'
CONT%(cn)d_CAP_SPACEPOOL_SIZE 'Number of Address Spaces'
CONT%(cn)d_CAP_MAPPOOL_SIZE 'Number of PMD Mappings (E.g. Middle-level Page Tables)'
CONT%(cn)d_CAP_MUTEXPOOL_SIZE 'Number of Userspace Mutexes'
CONT%(cn)d_CAP_CAPPOOL_SIZE 'Number of Capabilities (Created at run-time via Split, Replicate)'
CONT%(cn)d_CAP_THREADPOOL_USE 'Enable this Capability'
CONT%(cn)d_CAP_SPACEPOOL_USE 'Enable this Capability'
CONT%(cn)d_CAP_MAPPOOL_USE 'Enable this Capability'
CONT%(cn)d_CAP_MUTEXPOOL_USE 'Enable this Capability'
CONT%(cn)d_CAP_CAPPOOL_USE 'Enable this Capability'
cont%(cn)d_cap_threadpool 'Container %(cn)d Thread Pool Capability'
cont%(cn)d_cap_spacepool 'Container %(cn)d Space Pool Capability'
cont%(cn)d_cap_mutexpool 'Container %(cn)d Mutex Pool Capability'
cont%(cn)d_cap_mappool 'Container %(cn)d Map Pool Capability'
cont%(cn)d_cap_cappool 'Container %(cn)d Capability Pool Capability'
cont%(cn)d_cap_tctrl 'Container %(cn)d Thread Control Capability'
cont%(cn)d_cap_exregs 'Container %(cn)d Exchange Registers Capability'
cont%(cn)d_cap_ipc 'Container %(cn)d IPC Capability'
cont%(cn)d_cap_capctrl 'Container %(cn)d Capability Control Capability'
cont%(cn)d_cap_irqctrl 'Container %(cn)d IRQ Control Capability'
cont%(cn)d_cap_umutex 'Container %(cn)d Userspace Mutex Control Capability'
cont%(cn)d_cap_custom0 'Container %(cn)d Custom Capability 0 Parameters'
cont%(cn)d_cap_custom1 'Container %(cn)d Custom Capability 1 Parameters'
cont%(cn)d_cap_custom2 'Container %(cn)d Custom Capability 2 Parameters'
cont%(cn)d_cap_custom3 'Container %(cn)d Custom Capability 3 Parameters'
cont%(cn)d_capability_list 'Container %(cn)d Capability List'
default CONT%(cn)d_CAP_THREADPOOL_SIZE from 64
default CONT%(cn)d_CAP_SPACEPOOL_SIZE from 64
default CONT%(cn)d_CAP_MAPPOOL_SIZE from 800
default CONT%(cn)d_CAP_MUTEXPOOL_SIZE from 100
default CONT%(cn)d_CAP_CAPPOOL_SIZE from 32
default CONT%(cn)d_CAP_THREADPOOL_USE from y
default CONT%(cn)d_CAP_SPACEPOOL_USE from y
default CONT%(cn)d_CAP_MAPPOOL_USE from y
default CONT%(cn)d_CAP_MUTEXPOOL_USE from y
default CONT%(cn)d_CAP_CAPPOOL_USE from y
# Use Rules for Generic Capabilities
when CONT%(cn)d_CAP_THREADPOOL_USE == n
suppress CONT%(cn)d_CAP_THREADPOOL_SIZE
when CONT%(cn)d_CAP_SPACEPOOL_USE == n
suppress CONT%(cn)d_CAP_SPACEPOOL_SIZE
when CONT%(cn)d_CAP_MAPPOOL_USE == n
suppress CONT%(cn)d_CAP_MAPPOOL_SIZE
when CONT%(cn)d_CAP_MUTEXPOOL_USE == n
suppress CONT%(cn)d_CAP_MUTEXPOOL_SIZE
when CONT%(cn)d_CAP_CAPPOOL_USE == n
suppress CONT%(cn)d_CAP_CAPPOOL_SIZE
when CONT%(cn)d_CAP_IPC_USE == n
suppress CONT%(cn)d_CAP_IPC_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_IPC_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_IPC_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_IPC_TARGET_ANOTHER_PAGER
when CONT%(cn)d_CAP_EXREGS_USE == n
suppress CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE
when CONT%(cn)d_CAP_TCTRL_USE == n
suppress CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE
when CONT%(cn)d_CAP_CAPCTRL_USE == n
suppress CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE
when CONT%(cn)d_CAP_IRQCTRL_USE == n
suppress CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_PAGER_SPACE
when CONT%(cn)d_CAP_UMUTEX_USE == n
suppress CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE
when CONT%(cn)d_CAP_IPC_TARGET_CURRENT_CONTAINER or
CONT%(cn)d_CAP_IPC_TARGET_CURRENT_PAGER_SPACE
suppress CONT%(cn)d_CAP_IPC_TARGET
choicegroup CONT%(cn)d_CAP_IPC_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_IPC_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_IPC_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_IPC_TARGET_ANOTHER_PAGER
default CONT%(cn)d_CAP_IPC_TARGET_CURRENT_CONTAINER from y
choicegroup CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE
default CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_CONTAINER from y
choicegroup CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE
default CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_CONTAINER from y
choicegroup CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE
default CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER from y
choicegroup CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_PAGER_SPACE
default CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_CONTAINER from y
choicegroup CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE
default CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_CONTAINER from y
default CONT%(cn)d_CAP_TCTRL_USE from y
default CONT%(cn)d_CAP_EXREGS_USE from y
default CONT%(cn)d_CAP_IPC_USE from y
default CONT%(cn)d_CAP_CAPCTRL_USE from y
default CONT%(cn)d_CAP_IRQCTRL_USE from y
default CONT%(cn)d_CAP_UMUTEX_USE from y
default CONT%(cn)d_CAP_IPC_TARGET from 0
# Capability Menus
menu cont%(cn)d_cap_tctrl
CONT%(cn)d_CAP_TCTRL_USE
CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE
menu cont%(cn)d_cap_exregs
CONT%(cn)d_CAP_EXREGS_USE
CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE
menu cont%(cn)d_cap_capctrl
CONT%(cn)d_CAP_CAPCTRL_USE
CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE
menu cont%(cn)d_cap_umutex
CONT%(cn)d_CAP_UMUTEX_USE
CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE
menu cont%(cn)d_cap_irqctrl
CONT%(cn)d_CAP_IRQCTRL_USE
CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_IRQCTRL_TARGET_CURRENT_PAGER_SPACE
menu cont%(cn)d_cap_ipc
CONT%(cn)d_CAP_IPC_USE
CONT%(cn)d_CAP_IPC_TARGET_CURRENT_CONTAINER
CONT%(cn)d_CAP_IPC_TARGET_CURRENT_PAGER_SPACE
CONT%(cn)d_CAP_IPC_TARGET_ANOTHER_CONTAINER
CONT%(cn)d_CAP_IPC_TARGET_ANOTHER_PAGER
CONT%(cn)d_CAP_IPC_TARGET%
menu cont%(cn)d_cap_threadpool
CONT%(cn)d_CAP_THREADPOOL_USE
CONT%(cn)d_CAP_THREADPOOL_SIZE%
menu cont%(cn)d_cap_spacepool
CONT%(cn)d_CAP_SPACEPOOL_USE
CONT%(cn)d_CAP_SPACEPOOL_SIZE%
menu cont%(cn)d_cap_mappool
CONT%(cn)d_CAP_MAPPOOL_USE
CONT%(cn)d_CAP_MAPPOOL_SIZE%
menu cont%(cn)d_cap_mutexpool
CONT%(cn)d_CAP_MUTEXPOOL_USE
CONT%(cn)d_CAP_MUTEXPOOL_SIZE%
menu cont%(cn)d_cap_cappool
CONT%(cn)d_CAP_CAPPOOL_USE
CONT%(cn)d_CAP_CAPPOOL_SIZE%
menu cont%(cn)d_capability_list
cont%(cn)d_cap_threadpool
cont%(cn)d_cap_spacepool
cont%(cn)d_cap_mutexpool
cont%(cn)d_cap_mappool
cont%(cn)d_cap_cappool
cont%(cn)d_cap_tctrl
cont%(cn)d_cap_exregs
cont%(cn)d_cap_ipc
cont%(cn)d_cap_capctrl
cont%(cn)d_cap_umutex
cont%(cn)d_cap_irqctrl
cont%(cn)d_cap_custom0
cont%(cn)d_cap_custom1
cont%(cn)d_cap_custom2
cont%(cn)d_cap_custom3
menu container%(cn)d_options
CONT%(cn)d_OPT_NAME$
cont%(cn)d_baremetal_params
cont%(cn)d_linux_pager_params
cont%(cn)d_default_pager_params
cont%(cn)d_posix_pager_params
cont%(cn)d_physmem_list
cont%(cn)d_virtmem_list
cont%(cn)d_capability_list
cont%(cn)d_device_list
choices container%(cn)d_type
CONT%(cn)d_TYPE_BAREMETAL
CONT%(cn)d_TYPE_POSIX
CONT%(cn)d_TYPE_LINUX
default CONT%(cn)d_TYPE_BAREMETAL
menu cont%(cn)d_menu
container%(cn)d_type
container%(cn)d_options

View File

@@ -1,271 +0,0 @@
#
# Automatically generated, don't edit
#
# Generated on: amit-laptop
# At: Fri, 04 Dec 2009 05:32:36 +0000
# Linux version 2.6.28-11-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009
#
# Codezero Microkernel Configurator
#
#
# Main architecture
#
CONFIG_ARCH_ARM=y
#
# ARM Architecture Configuration
#
#
# ARM Architecture Family
#
CONFIG_SUBARCH_V5=y
CONFIG_SUBARCH_V6=n
CONFIG_SUBARCH_V7=n
#
# ARM CPU type
#
#
# ARM Processor Type
#
CONFIG_CPU_ARM926=y
#
# ARM Platform Type
#
#
# ARM Platform Type
#
CONFIG_PLATFORM_EB=n
CONFIG_PLATFORM_PB926=y
#
# Toolchain Prefix
#
CONFIG_TOOLCHAIN_KERNEL="arm-none-eabi-"
CONFIG_TOOLCHAIN_USER="arm-none-linux-gnueabi-"
CONFIG_CONTAINERS=1
#
# Container Setup
#
CONFIG_CAPABILITIES=y
#
# Container 0 Parameters
#
#
# Container 0 Type
#
CONFIG_CONT0_TYPE_BAREMETAL=n
CONFIG_CONT0_TYPE_POSIX=n
CONFIG_CONT0_TYPE_LINUX=y
#
# Container 0 Options
#
CONFIG_CONT0_OPT_NAME="linux0"
#
# Container 0 Linux Pager Parameters
#
CONFIG_CONT0_LINUX_PHYS_OFFSET=0x100000
CONFIG_CONT0_LINUX_ZRELADDR=0x108000
CONFIG_CONT0_LINUX_ROOTFS_ADDRESS=0x600000
CONFIG_CONT0_LINUX_PAGE_OFFSET=0xa0000000
#
# Container 0 Physical Memory Regions (Capabilities)
#
CONFIG_CONT0_PHYSMEM_REGIONS=1
CONFIG_CONT0_PHYS0_START=0x100000
CONFIG_CONT0_PHYS0_END=0xe00000
#
# Container 0 Virtual Memory Regions (Capabilities)
#
CONFIG_CONT0_VIRTMEM_REGIONS=1
CONFIG_CONT0_VIRT0_START=0xa0000000
CONFIG_CONT0_VIRT0_END=0xb0000000
#
# Container 0 Capability List
#
#
# Container 0 Thread Pool Capability
#
CONFIG_CONT0_CAP_THREADPOOL_USE=y
CONFIG_CONT0_CAP_THREADPOOL_SIZE=64
#
# Container 0 Space Pool Capability
#
CONFIG_CONT0_CAP_SPACEPOOL_USE=y
CONFIG_CONT0_CAP_SPACEPOOL_SIZE=64
#
# Container 0 Mutex Pool Capability
#
CONFIG_CONT0_CAP_MUTEXPOOL_USE=y
CONFIG_CONT0_CAP_MUTEXPOOL_SIZE=100
#
# Container 0 Map Pool Capability
#
CONFIG_CONT0_CAP_MAPPOOL_USE=y
CONFIG_CONT0_CAP_MAPPOOL_SIZE=800
#
# Container 0 Capability Pool Capability
#
CONFIG_CONT0_CAP_CAPPOOL_USE=y
CONFIG_CONT0_CAP_CAPPOOL_SIZE=32
#
# Container 0 Thread Control Capability
#
CONFIG_CONT0_CAP_TCTRL_USE=y
CONFIG_CONT0_CAP_TCTRL_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Exchange Registers Capability
#
CONFIG_CONT0_CAP_EXREGS_USE=y
CONFIG_CONT0_CAP_EXREGS_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 IPC Capability
#
CONFIG_CONT0_CAP_IPC_USE=y
CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n
CONFIG_CONT0_CAP_IPC_TARGET_ANOTHER_CONTAINER=n
CONFIG_CONT0_CAP_IPC_TARGET_ANOTHER_PAGER=n
#
# Container 0 Capability Control Capability
#
CONFIG_CONT0_CAP_CAPCTRL_USE=y
CONFIG_CONT0_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Userspace Mutex Control Capability
#
CONFIG_CONT0_CAP_UMUTEX_USE=y
CONFIG_CONT0_CAP_UMUTEX_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Custom Capability 0 Parameters
#
CONFIG_CONT0_CAP_CUSTOM0_USE=n
#
# Container 0 Custom Capability 1 Parameters
#
CONFIG_CONT0_CAP_CUSTOM1_USE=n
#
# Container 0 Custom Capability 2 Parameters
#
CONFIG_CONT0_CAP_CUSTOM2_USE=n
#
# Container 0 Custom Capability 3 Parameters
#
CONFIG_CONT0_CAP_CUSTOM3_USE=n
#
# Container 0 Devices (Capabilities)
#
#
# Container 0 UART1 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART1_USE=n
#
# Container 0 UART2 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART2_USE=n
#
# Container 0 UART3 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART3_USE=n
#
# Container 0 TIMER23 Menu
#
CONFIG_CONT0_CAP_DEVICE_TIMER1_USE=n
#
# Derived symbols
#
CONFIG_CONT1_PAGER_LOAD_ADDR=0x1100000
CONFIG_DRIVER_IRQ_PL190=y
CONFIG_DRIVER_TIMER_SP804=y
CONFIG_CONT2_START_PC_ADDR=0xc0000000
CONFIG_CONT3_START_PC_ADDR=0xd0000000
CONFIG_DRIVER_IRQ_GIC=n
CONFIG_CONT2_PAGER_VIRT_ADDR=0xc0000000
CONFIG_baremetal2="baremetal_noname2"
CONFIG_CONT2_PAGER_LOAD_ADDR=0x2100000
CONFIG_CONT1_PAGER_VIRT_ADDR=0xb0000000
CONFIG_CONT3_PAGER_LOAD_ADDR=0x3100000
CONFIG_CONT0_PAGER_LOAD_ADDR=0x100000
CONFIG_CONT0_PAGER_VIRT_ADDR=0xa0000000
CONFIG_baremetal1="baremetal_noname1"
CONFIG_baremetal0="empty0"
CONFIG_baremetal3="baremetal_noname3"
CONFIG_DRIVER_UART_PL011=y
CONFIG_CONT3_PAGER_VIRT_ADDR=0xd0000000
CONFIG_CONT0_START_PC_ADDR=0xa0008000
CONFIG_CONT1_START_PC_ADDR=0xb0000000
#
# That's all, folks!

View File

@@ -1,285 +0,0 @@
#
# Automatically generated, don't edit
#
# Generated on: amit-laptop
# At: Fri, 04 Dec 2009 05:37:15 +0000
# Linux version 2.6.28-11-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009
#
# Codezero Microkernel Configurator
#
#
# Main architecture
#
CONFIG_ARCH_ARM=y
#
# ARM Architecture Configuration
#
#
# ARM Architecture Family
#
CONFIG_SUBARCH_V5=y
CONFIG_SUBARCH_V6=n
CONFIG_SUBARCH_V7=n
#
# ARM CPU type
#
#
# ARM Processor Type
#
CONFIG_CPU_ARM926=y
#
# ARM Platform Type
#
#
# ARM Platform Type
#
CONFIG_PLATFORM_EB=n
CONFIG_PLATFORM_PB926=y
#
# Toolchain Prefix
#
CONFIG_TOOLCHAIN="arm-none-eabi-"
CONFIG_CONTAINERS=1
#
# Container Setup
#
CONFIG_CAPABILITIES=y
#
# Container 0 Parameters
#
#
# Container 0 Type
#
CONFIG_CONT0_TYPE_BAREMETAL=n
CONFIG_CONT0_TYPE_POSIX=y
CONFIG_CONT0_TYPE_LINUX=n
#
# Container 0 Options
#
CONFIG_CONT0_OPT_NAME="posix0"
#
# Container 0 Default Pager Parameters
#
CONFIG_CONT0_PAGER_LMA=0x100000
CONFIG_CONT0_PAGER_VMA=0xa0000000
#
# Container 0 POSIX Pager Parameters
#
CONFIG_CONT0_PAGER_SHM_START=0x80000000
CONFIG_CONT0_PAGER_SHM_END=0x88000000
CONFIG_CONT0_PAGER_TASK_START=0x40000000
CONFIG_CONT0_PAGER_TASK_END=0x50000000
CONFIG_CONT0_PAGER_UTCB_START=0xf8100000
CONFIG_CONT0_PAGER_UTCB_END=0xf8200000
#
# Container 0 Physical Memory Regions (Capabilities)
#
CONFIG_CONT0_PHYSMEM_REGIONS=1
CONFIG_CONT0_PHYS0_START=0x100000
CONFIG_CONT0_PHYS0_END=0xe00000
#
# Container 0 Virtual Memory Regions (Capabilities)
#
CONFIG_CONT0_VIRTMEM_REGIONS=4
CONFIG_CONT0_VIRT0_START=0xa0000000
CONFIG_CONT0_VIRT0_END=0xb0000000
CONFIG_CONT0_VIRT1_START=0x80000000
CONFIG_CONT0_VIRT1_END=0x88000000
CONFIG_CONT0_VIRT2_START=0x40000000
CONFIG_CONT0_VIRT2_END=0x50000000
CONFIG_CONT0_VIRT3_START=0xf8100000
CONFIG_CONT0_VIRT3_END=0xf8200000
#
# Container 0 Capability List
#
#
# Container 0 Thread Pool Capability
#
CONFIG_CONT0_CAP_THREADPOOL_USE=y
CONFIG_CONT0_CAP_THREADPOOL_SIZE=64
#
# Container 0 Space Pool Capability
#
CONFIG_CONT0_CAP_SPACEPOOL_USE=y
CONFIG_CONT0_CAP_SPACEPOOL_SIZE=64
#
# Container 0 Mutex Pool Capability
#
CONFIG_CONT0_CAP_MUTEXPOOL_USE=y
CONFIG_CONT0_CAP_MUTEXPOOL_SIZE=100
#
# Container 0 Map Pool Capability
#
CONFIG_CONT0_CAP_MAPPOOL_USE=y
CONFIG_CONT0_CAP_MAPPOOL_SIZE=800
#
# Container 0 Capability Pool Capability
#
CONFIG_CONT0_CAP_CAPPOOL_USE=y
CONFIG_CONT0_CAP_CAPPOOL_SIZE=32
#
# Container 0 Thread Control Capability
#
CONFIG_CONT0_CAP_TCTRL_USE=y
CONFIG_CONT0_CAP_TCTRL_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Exchange Registers Capability
#
CONFIG_CONT0_CAP_EXREGS_USE=y
CONFIG_CONT0_CAP_EXREGS_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 IPC Capability
#
CONFIG_CONT0_CAP_IPC_USE=y
CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n
CONFIG_CONT0_CAP_IPC_TARGET_ANOTHER_CONTAINER=n
CONFIG_CONT0_CAP_IPC_TARGET_ANOTHER_PAGER=n
#
# Container 0 Capability Control Capability
#
CONFIG_CONT0_CAP_CAPCTRL_USE=y
CONFIG_CONT0_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Userspace Mutex Control Capability
#
CONFIG_CONT0_CAP_UMUTEX_USE=y
CONFIG_CONT0_CAP_UMUTEX_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Custom Capability 0 Parameters
#
CONFIG_CONT0_CAP_CUSTOM0_USE=n
#
# Container 0 Custom Capability 1 Parameters
#
CONFIG_CONT0_CAP_CUSTOM1_USE=n
#
# Container 0 Custom Capability 2 Parameters
#
CONFIG_CONT0_CAP_CUSTOM2_USE=n
#
# Container 0 Custom Capability 3 Parameters
#
CONFIG_CONT0_CAP_CUSTOM3_USE=n
#
# Container 0 Devices (Capabilities)
#
#
# Container 0 UART1 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART1_USE=n
#
# Container 0 UART2 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART2_USE=n
#
# Container 0 UART3 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART3_USE=n
#
# Container 0 TIMER23 Menu
#
CONFIG_CONT0_CAP_DEVICE_TIMER1_USE=n
#
# Derived symbols
#
CONFIG_CONT1_PAGER_LOAD_ADDR=0x1100000
CONFIG_DRIVER_IRQ_PL190=y
CONFIG_DRIVER_TIMER_SP804=y
CONFIG_CONT2_START_PC_ADDR=0xc0000000
CONFIG_CONT3_START_PC_ADDR=0xd0000000
CONFIG_DRIVER_IRQ_GIC=n
CONFIG_CONT2_PAGER_VIRT_ADDR=0xc0000000
CONFIG_baremetal2="baremetal_noname2"
CONFIG_CONT2_PAGER_LOAD_ADDR=0x2100000
CONFIG_CONT1_PAGER_VIRT_ADDR=0xb0000000
CONFIG_CONT3_PAGER_LOAD_ADDR=0x3100000
CONFIG_CONT0_PAGER_LOAD_ADDR=0x100000
CONFIG_CONT0_PAGER_VIRT_ADDR=0xa0000000
CONFIG_baremetal1="baremetal_noname1"
CONFIG_baremetal0="empty0"
CONFIG_baremetal3="baremetal_noname3"
CONFIG_DRIVER_UART_PL011=y
CONFIG_CONT3_PAGER_VIRT_ADDR=0xd0000000
CONFIG_CONT0_START_PC_ADDR=0xa0000000
CONFIG_CONT1_START_PC_ADDR=0xb0000000
#
# That's all, folks!

View File

@@ -1,479 +0,0 @@
#
# Automatically generated, don't edit
#
# Generated on: amit-laptop
# At: Fri, 04 Dec 2009 05:19:22 +0000
# Linux version 2.6.28-11-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009
#
# Codezero Microkernel Configurator
#
#
# Main architecture
#
CONFIG_ARCH_ARM=y
#
# ARM Architecture Configuration
#
#
# ARM Architecture Family
#
CONFIG_SUBARCH_V5=y
CONFIG_SUBARCH_V6=n
CONFIG_SUBARCH_V7=n
#
# ARM CPU type
#
#
# ARM Processor Type
#
CONFIG_CPU_ARM926=y
#
# ARM Platform Type
#
#
# ARM Platform Type
#
CONFIG_PLATFORM_EB=n
CONFIG_PLATFORM_PB926=y
#
# Toolchain Prefix
#
CONFIG_TOOLCHAIN="arm-none-eabi-"
CONFIG_CONTAINERS=2
#
# Container Setup
#
CONFIG_CAPABILITIES=y
#
# Container 0 Parameters
#
#
# Container 0 Type
#
CONFIG_CONT0_TYPE_BAREMETAL=n
CONFIG_CONT0_TYPE_POSIX=y
CONFIG_CONT0_TYPE_LINUX=n
#
# Container 0 Options
#
CONFIG_CONT0_OPT_NAME="posix0"
#
# Container 0 Default Pager Parameters
#
CONFIG_CONT0_PAGER_LMA=0x100000
CONFIG_CONT0_PAGER_VMA=0xa0000000
#
# Container 0 POSIX Pager Parameters
#
CONFIG_CONT0_PAGER_SHM_START=0x80000000
CONFIG_CONT0_PAGER_SHM_END=0x88000000
CONFIG_CONT0_PAGER_TASK_START=0x40000000
CONFIG_CONT0_PAGER_TASK_END=0x50000000
CONFIG_CONT0_PAGER_UTCB_START=0xf8100000
CONFIG_CONT0_PAGER_UTCB_END=0xf8200000
#
# Container 0 Physical Memory Regions (Capabilities)
#
CONFIG_CONT0_PHYSMEM_REGIONS=1
CONFIG_CONT0_PHYS0_START=0x100000
CONFIG_CONT0_PHYS0_END=0xe00000
#
# Container 0 Virtual Memory Regions (Capabilities)
#
CONFIG_CONT0_VIRTMEM_REGIONS=4
CONFIG_CONT0_VIRT0_START=0xa0000000
CONFIG_CONT0_VIRT0_END=0xb0000000
CONFIG_CONT0_VIRT1_START=0x80000000
CONFIG_CONT0_VIRT1_END=0x88000000
CONFIG_CONT0_VIRT2_START=0x40000000
CONFIG_CONT0_VIRT2_END=0x50000000
CONFIG_CONT0_VIRT3_START=0xf8100000
CONFIG_CONT0_VIRT3_END=0xf8200000
#
# Container 0 Capability List
#
#
# Container 0 Thread Pool Capability
#
CONFIG_CONT0_CAP_THREADPOOL_USE=y
CONFIG_CONT0_CAP_THREADPOOL_SIZE=64
#
# Container 0 Space Pool Capability
#
CONFIG_CONT0_CAP_SPACEPOOL_USE=y
CONFIG_CONT0_CAP_SPACEPOOL_SIZE=64
#
# Container 0 Mutex Pool Capability
#
CONFIG_CONT0_CAP_MUTEXPOOL_USE=y
CONFIG_CONT0_CAP_MUTEXPOOL_SIZE=100
#
# Container 0 Map Pool Capability
#
CONFIG_CONT0_CAP_MAPPOOL_USE=y
CONFIG_CONT0_CAP_MAPPOOL_SIZE=800
#
# Container 0 Capability Pool Capability
#
CONFIG_CONT0_CAP_CAPPOOL_USE=y
CONFIG_CONT0_CAP_CAPPOOL_SIZE=32
#
# Container 0 Thread Control Capability
#
CONFIG_CONT0_CAP_TCTRL_USE=y
CONFIG_CONT0_CAP_TCTRL_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Exchange Registers Capability
#
CONFIG_CONT0_CAP_EXREGS_USE=y
CONFIG_CONT0_CAP_EXREGS_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 IPC Capability
#
CONFIG_CONT0_CAP_IPC_USE=y
CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n
CONFIG_CONT0_CAP_IPC_TARGET_ANOTHER_CONTAINER=n
CONFIG_CONT0_CAP_IPC_TARGET_ANOTHER_PAGER=n
#
# Container 0 Capability Control Capability
#
CONFIG_CONT0_CAP_CAPCTRL_USE=y
CONFIG_CONT0_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Userspace Mutex Control Capability
#
CONFIG_CONT0_CAP_UMUTEX_USE=y
CONFIG_CONT0_CAP_UMUTEX_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 0 Custom Capability 0 Parameters
#
CONFIG_CONT0_CAP_CUSTOM0_USE=n
#
# Container 0 Custom Capability 1 Parameters
#
CONFIG_CONT0_CAP_CUSTOM1_USE=n
#
# Container 0 Custom Capability 2 Parameters
#
CONFIG_CONT0_CAP_CUSTOM2_USE=n
#
# Container 0 Custom Capability 3 Parameters
#
CONFIG_CONT0_CAP_CUSTOM3_USE=n
#
# Container 0 Devices (Capabilities)
#
#
# Container 0 UART1 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART1_USE=n
#
# Container 0 UART2 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART2_USE=n
#
# Container 0 UART3 Menu
#
CONFIG_CONT0_CAP_DEVICE_UART3_USE=n
#
# Container 0 TIMER23 Menu
#
CONFIG_CONT0_CAP_DEVICE_TIMER1_USE=n
#
# Container 1 Parameters
#
#
# Container 1 Type
#
CONFIG_CONT1_TYPE_BAREMETAL=n
CONFIG_CONT1_TYPE_POSIX=y
CONFIG_CONT1_TYPE_LINUX=n
#
# Container 1 Options
#
CONFIG_CONT1_OPT_NAME="posix1"
#
# Container 1 Default Pager Parameters
#
CONFIG_CONT1_PAGER_LMA=0x1100000
CONFIG_CONT1_PAGER_VMA=0xb0000000
#
# Container 1 POSIX Pager Parameters
#
CONFIG_CONT1_PAGER_SHM_START=0x88000000
CONFIG_CONT1_PAGER_SHM_END=0x90000000
CONFIG_CONT1_PAGER_TASK_START=0x50000000
CONFIG_CONT1_PAGER_TASK_END=0x60000000
CONFIG_CONT1_PAGER_UTCB_START=0xf8200000
CONFIG_CONT1_PAGER_UTCB_END=0xf8300000
#
# Container 1 Physical Memory Regions (Capabilities)
#
CONFIG_CONT1_PHYSMEM_REGIONS=1
CONFIG_CONT1_PHYS0_START=0x1100000
CONFIG_CONT1_PHYS0_END=0x1e00000
#
# Container 1 Virtual Memory Regions (Capabilities)
#
CONFIG_CONT1_VIRTMEM_REGIONS=4
CONFIG_CONT1_VIRT0_START=0xb0000000
CONFIG_CONT1_VIRT0_END=0xc0000000
CONFIG_CONT1_VIRT1_START=0x88000000
CONFIG_CONT1_VIRT1_END=0x90000000
CONFIG_CONT1_VIRT2_START=0x50000000
CONFIG_CONT1_VIRT2_END=0x60000000
CONFIG_CONT1_VIRT3_START=0xf8200000
CONFIG_CONT1_VIRT3_END=0xf8300000
#
# Container 1 Capability List
#
#
# Container 1 Thread Pool Capability
#
CONFIG_CONT1_CAP_THREADPOOL_USE=y
CONFIG_CONT1_CAP_THREADPOOL_SIZE=64
#
# Container 1 Space Pool Capability
#
CONFIG_CONT1_CAP_SPACEPOOL_USE=y
CONFIG_CONT1_CAP_SPACEPOOL_SIZE=64
#
# Container 1 Mutex Pool Capability
#
CONFIG_CONT1_CAP_MUTEXPOOL_USE=y
CONFIG_CONT1_CAP_MUTEXPOOL_SIZE=100
#
# Container 1 Map Pool Capability
#
CONFIG_CONT1_CAP_MAPPOOL_USE=y
CONFIG_CONT1_CAP_MAPPOOL_SIZE=800
#
# Container 1 Capability Pool Capability
#
CONFIG_CONT1_CAP_CAPPOOL_USE=y
CONFIG_CONT1_CAP_CAPPOOL_SIZE=32
#
# Container 1 Thread Control Capability
#
CONFIG_CONT1_CAP_TCTRL_USE=y
CONFIG_CONT1_CAP_TCTRL_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT1_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 1 Exchange Registers Capability
#
CONFIG_CONT1_CAP_EXREGS_USE=y
CONFIG_CONT1_CAP_EXREGS_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT1_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 1 IPC Capability
#
CONFIG_CONT1_CAP_IPC_USE=y
CONFIG_CONT1_CAP_IPC_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT1_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n
CONFIG_CONT1_CAP_IPC_TARGET_ANOTHER_CONTAINER=n
CONFIG_CONT1_CAP_IPC_TARGET_ANOTHER_PAGER=n
#
# Container 1 Capability Control Capability
#
CONFIG_CONT1_CAP_CAPCTRL_USE=y
CONFIG_CONT1_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT1_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 1 Userspace Mutex Control Capability
#
CONFIG_CONT1_CAP_UMUTEX_USE=y
CONFIG_CONT1_CAP_UMUTEX_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT1_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE=n
#
# Container 1 Custom Capability 0 Parameters
#
CONFIG_CONT1_CAP_CUSTOM0_USE=n
#
# Container 1 Custom Capability 1 Parameters
#
CONFIG_CONT1_CAP_CUSTOM1_USE=n
#
# Container 1 Custom Capability 2 Parameters
#
CONFIG_CONT1_CAP_CUSTOM2_USE=n
#
# Container 1 Custom Capability 3 Parameters
#
CONFIG_CONT1_CAP_CUSTOM3_USE=n
#
# Container 1 Devices (Capabilities)
#
#
# Container 1 UART1 Menu
#
CONFIG_CONT1_CAP_DEVICE_UART1_USE=n
#
# Container 1 UART2 Menu
#
CONFIG_CONT1_CAP_DEVICE_UART2_USE=n
#
# Container 1 UART3 Menu
#
CONFIG_CONT1_CAP_DEVICE_UART3_USE=n
#
# Container 1 TIMER23 Menu
#
CONFIG_CONT1_CAP_DEVICE_TIMER1_USE=n
#
# Derived symbols
#
CONFIG_CONT1_PAGER_LOAD_ADDR=0x1100000
CONFIG_DRIVER_IRQ_PL190=y
CONFIG_DRIVER_TIMER_SP804=y
CONFIG_CONT2_START_PC_ADDR=0xc0000000
CONFIG_CONT3_START_PC_ADDR=0xd0000000
CONFIG_DRIVER_IRQ_GIC=n
CONFIG_CONT2_PAGER_VIRT_ADDR=0xc0000000
CONFIG_baremetal2="baremetal_noname2"
CONFIG_CONT2_PAGER_LOAD_ADDR=0x2100000
CONFIG_CONT1_PAGER_VIRT_ADDR=0xb0000000
CONFIG_CONT3_PAGER_LOAD_ADDR=0x3100000
CONFIG_CONT0_PAGER_LOAD_ADDR=0x100000
CONFIG_CONT0_PAGER_VIRT_ADDR=0xa0000000
CONFIG_baremetal1="empty1"
CONFIG_baremetal0="empty0"
CONFIG_baremetal3="baremetal_noname3"
CONFIG_DRIVER_UART_PL011=y
CONFIG_CONT3_PAGER_VIRT_ADDR=0xd0000000
CONFIG_CONT0_START_PC_ADDR=0xa0000000
CONFIG_CONT1_START_PC_ADDR=0xb0000000
#
# That's all, folks!

View File

@@ -1,41 +0,0 @@
#! /usr/bin/env python2.6
# -*- mode: python; coding: utf-8; -*-
import os, sys, shelve, shutil
from os.path import join
# Way to get project root from any script importing this one :-)
PROJROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
BUILDDIR = join(PROJROOT, "build")
TOOLSDIR = join(PROJROOT, "tools")
CML2_CONFIG_SRCDIR = join(PROJROOT, "config/cml")
CML2_CONT_DEFFILE = join(PROJROOT, 'config/cml/container_ruleset.template')
CML2TOOLSDIR = join(TOOLSDIR, "cml2-tools")
CML2_COMPILED_RULES = join(BUILDDIR, "rules.compiled")
CML2_CONFIG_FILE = join(BUILDDIR, "config.cml")
CML2_CONFIG_FILE_SAVED = join(BUILDDIR, "config.cml.saved")
CML2_CONFIG_H = join(BUILDDIR, "config.h")
CML2_AUTOGEN_RULES = join(BUILDDIR, 'config.rules')
CONFIG_H = join("include/l4/config.h")
CONFIG_SHELVE_DIR = join(BUILDDIR, "configdata")
CONFIG_SHELVE_FILENAME = "configuration"
CONFIG_SHELVE = join(CONFIG_SHELVE_DIR, CONFIG_SHELVE_FILENAME)
KERNEL_CINFO_PATH = join(PROJROOT, "src/generic/cinfo.c")
LINUXDIR = join(PROJROOT, 'conts/linux')
LINUX_KERNELDIR = join(LINUXDIR, 'linux-2.6.33')
LINUX_ROOTFSDIR = join(LINUXDIR, 'rootfs')
LINUX_ATAGSDIR = join(LINUXDIR, 'atags')
POSIXDIR = join(PROJROOT, 'conts/posix')
POSIX_BOOTDESCDIR = join(POSIXDIR, 'bootdesc')
projpaths = { \
'LINUX_ATAGSDIR' : LINUX_ATAGSDIR, \
'LINUX_ROOTFSDIR' : LINUX_ROOTFSDIR, \
'LINUX_KERNELDIR' : LINUX_KERNELDIR, \
'LINUXDIR' : LINUXDIR, \
'BUILDDIR' : BUILDDIR, \
'POSIXDIR' : POSIXDIR, \
'POSIX_BOOTDESCDIR' : POSIX_BOOTDESCDIR
}

View File

@@ -0,0 +1,11 @@
# Inherit global environment
Import('env')
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -7,60 +7,49 @@
import os, shelve, sys import os, shelve, sys
from os.path import * from os.path import *
PROJRELROOT = '../..' CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
sys.path.append(PROJRELROOT) from scripts.config.projpaths import *
from scripts.conts.containers import *
from config.projpaths import * from scripts.config.configuration import *
from config.configuration import *
config = configuration_retrieve() config = configuration_retrieve()
platform = config.platform
arch = config.arch
gcc_arch_flag = config.gcc_arch_flag gcc_arch_flag = config.gcc_arch_flag
LIBL4_RELDIR = 'conts/libl4' cid = int(ARGUMENTS.get('cid', 0))
KERNEL_INCLUDE = join(PROJROOT, 'include') cont = find_container_from_cid(cid)
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
# Locally important paths are here builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
LIBC_RELDIR = 'conts/libc'
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
join(LIBC_DIR, 'include/arch' + '/' + arch)]
LIBDEV_RELDIR = 'conts/libdev' # linker.lds is generated either in conts/xxx or build/contx/include
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) if cont.duplicate == 0:
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') linker_lds = join(builddir, 'include/linker.lds')
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')] else:
linker_lds = 'include/linker.lds'
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
LIBMEM_INCLUDE = LIBMEM_DIR
env = Environment(CC = config.toolchain_userspace + 'gcc', env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk(). # such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \ CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag], '-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"], LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'], \ ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable\ PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path\ ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', 'gcc', \ # libgcc.a - This is required for division routines.
'libmm', 'libmc', 'libmalloc','c-userspace'], # libgcc.a - This is required for division routines. LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', 'gcc',
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, \ 'libmem', 'c-userspace'],
LIBC_INCLUDE, LIBMEM_INCLUDE], CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH], LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
src = Glob('*.[cS]') objs = SConscript('SConscript', exports = { 'env' : env },
src += Glob('src/*.[cS]') duplicate=0, build_dir = builddir)
objs = env.Object(src) Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program('main.elf', objs) prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, 'include/linker.lds') Depends(prog, linker_lds)

View File

@@ -0,0 +1,11 @@
# Inherit global environment
Import('env')
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -4,64 +4,54 @@
# #
# Copyright © 2009 B Labs Ltd # Copyright © 2009 B Labs Ltd
# #
import os, shelve, sys import os, sys
from os.path import * from os.path import *
PROJRELROOT = '../..' CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
sys.path.append(PROJRELROOT) from scripts.config.projpaths import *
from scripts.conts.containers import *
from config.projpaths import * from scripts.config.configuration import *
from config.configuration import *
config = configuration_retrieve() config = configuration_retrieve()
platform = config.platform
arch = config.arch
gcc_arch_flag = config.gcc_arch_flag gcc_arch_flag = config.gcc_arch_flag
LIBL4_RELDIR = 'conts/libl4' cid = int(ARGUMENTS.get('cid', 0))
KERNEL_INCLUDE = join(PROJROOT, 'include') cont = find_container_from_cid(cid)
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
# Locally important paths are here builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
LIBC_RELDIR = 'conts/libc'
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
join(LIBC_DIR, 'include/arch' + '/' + arch)]
LIBDEV_RELDIR = 'conts/libdev' # linker.lds is generated either in conts/xxx or build/contx/include
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) if cont.duplicate == 0:
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') linker_lds = join(builddir, 'include/linker.lds')
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')] else:
linker_lds = 'include/linker.lds'
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
LIBMEM_INCLUDE = LIBMEM_DIR
env = Environment(CC = config.toolchain_userspace + 'gcc', env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk(). # such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \ CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag], '-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"],\ LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'], \ ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', \ LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace',
'libmm', 'libmc', 'libmalloc', 'gcc', 'c-userspace'], 'libmem', 'gcc', 'c-userspace'],
# libgcc.a - This is required for division routines. # libgcc.a - This is required for division routines.
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, \ CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
LIBC_INCLUDE, LIBMEM_INCLUDE], LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH], LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h -include l4lib/macros.h') CPPFLAGS = '-include l4/config.h -include l4/macros.h \
-include l4/types.h -include l4lib/macros.h')
src = Glob('*.[cS]') objs = SConscript('SConscript', exports = { 'env' : env },
src += Glob('src/*.[cS]') duplicate=0, build_dir = builddir)
objs = env.Object(src) Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program('main.elf', objs)
Depends(prog, 'include/linker.lds') prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, linker_lds)

View File

@@ -0,0 +1,11 @@
# Inherit global environment
Import('env')
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -0,0 +1,57 @@
# -*- mode: python; coding: utf-8; -*-
#
# Codezero -- Virtualization microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
import os, shelve, sys
from os.path import *
CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
from scripts.config.projpaths import *
from scripts.conts.containers import *
from scripts.config.configuration import *
config = configuration_retrieve()
gcc_arch_flag = config.gcc_arch_flag
cid = int(ARGUMENTS.get('cid', 0))
cont = find_container_from_cid(cid)
builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
# linker.lds is generated either in conts/xxx or build/contx/include
if cont.duplicate == 0:
linker_lds = join(builddir, 'include/linker.lds')
else:
linker_lds = 'include/linker.lds'
env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace',
'libmem', 'gcc', 'c-userspace'],
# libgcc.a - This is required for division routines.
CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h \
-include l4/types.h -include l4lib/macros.h')
objs = SConscript('SConscript', exports = { 'env' : env },
duplicate=0, build_dir = builddir)
Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, linker_lds)

View File

@@ -8,7 +8,7 @@ process. It is meant to be the most simple to get on with, therefore if
you feel any complications, please reach us on our l4dev.org mailing list you feel any complications, please reach us on our l4dev.org mailing list
on http://lists.l4dev.org/mailman/listinfo/codezero-devel on http://lists.l4dev.org/mailman/listinfo/codezero-devel
You have created a new container called `test_suite0'. You have created a new container called `ipc_demo0'.
The parameters you have supplied are described in the ".container" file The parameters you have supplied are described in the ".container" file
placed at the top-level directory. Note, that this is only an informative placed at the top-level directory. Note, that this is only an informative

View File

@@ -6,8 +6,7 @@
#include <l4lib/init.h> #include <l4lib/init.h>
#include <l4lib/utcb.h> #include <l4lib/utcb.h>
#include <l4lib/lib/thread.h>
#include <l4lib/lib/cap.h>
extern void main(void); extern void main(void);
@@ -16,12 +15,6 @@ void __container_init(void)
/* Generic L4 initialisation */ /* Generic L4 initialisation */
__l4_init(); __l4_init();
/* Thread library initialisation */
__l4_threadlib_init();
/* Capability library initialization */
__l4_capability_init();
/* Entry to main */ /* Entry to main */
main(); main();
} }

View File

@@ -5,7 +5,7 @@
#define __CONTAINER_H__ #define __CONTAINER_H__
#define __CONTAINER_NAME__ "test_suite0" #define __CONTAINER_NAME__ "ipc_demo0"
#define __CONTAINER_ID__ 0 #define __CONTAINER_ID__ 0
#define __CONTAINER__ "cont0" #define __CONTAINER__ "cont0"

View File

@@ -0,0 +1,55 @@
/*
* Example working linker script for this container.
*
* Copyright (C) 2009 B Labs Ltd.
*/
vma_start = 0xa0000000;
lma_start = 0x100000;
offset = vma_start - lma_start;
OUTPUT_ARCH(arm)
ENTRY(_start)
PHDRS
{
rx PT_LOAD;
rw PT_LOAD;
}
SECTIONS
{
. = vma_start;
/* Put all RX, RO sections here */
.text : AT (ADDR(.text) - offset)
{
*(.text.head) *(.text)
} : rx = 0x90909090
.rodata : AT (ADDR(.rodata) - offset)
{
*(.rodata)
} : rx = 0x90909090
.rodata1 : AT (ADDR(.rodata1) - offset)
{
*(.rodata1)
} : rx = 0x90909090
. = ALIGN(4K);
/* Put all RW sections here */
.data : AT (ADDR(.data) - offset)
{
*(.data)
} : rw
.bss : AT (ADDR(.bss) - offset)
{
*(.bss)
. += 0x1000;
. = ALIGN(8);
__stack = .;
} : rw
__end = .;
}

View File

@@ -0,0 +1,13 @@
#ifndef __TESTS_H__
#define __TESTS_H__
//#define DEBUG
#ifdef DEBUG
#define dgb_printf printf
#else
#define dbg_printf(fmt,...)
#endif
#endif

View File

@@ -0,0 +1,29 @@
/*
* Main function for this container
*/
#include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syslib.h)
#include L4LIB_INC_ARCH(syscalls.h)
#include <l4/api/space.h>
#include <l4lib/lib/thread.h>
#include <l4lib/lib/cap.h>
#include <memory.h>
extern int ipc_demo(void);
int main(void)
{
__l4_threadlib_init();
__l4_capability_init();
page_pool_init();
ipc_demo();
return 0;
}

View File

@@ -0,0 +1,547 @@
/*
* Test ipc system call.
*
* Copyright (C) 2010 B Labs Ltd.
*
* Author: Bahadir Balban
*/
#include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syslib.h)
#include L4LIB_INC_ARCH(syscalls.h)
#include <l4lib/lib/thread.h>
#include <l4lib/ipcdefs.h>
#include <tests.h>
//#include <macros.h>
#include <fault.h>
#include <memory.h>
struct ipc_ext_data {
void *virtual; /* Virtual address to start ipc from */
l4id_t partner; /* Partner to do extended ipc */
};
int ipc_extended_sender(void *arg)
{
struct ipc_ext_data *data = arg;
int err;
if ((err = l4_send_extended(data->partner, 0,
SZ_2K, data->virtual)) < 0) {
printf("%s: Extended send failed. err=%d\n",
__FUNCTION__, err);
}
return 0;
}
int ipc_extended_receiver(void *arg)
{
struct ipc_ext_data *data = arg;
int err;
if ((err = l4_receive_extended(data->partner, SZ_2K,
data->virtual)) < 0) {
printf("%s: Extended receive failed. err=%d\n",
__FUNCTION__, err);
}
/*
* Test the data received
*/
for (int i = 0; i < SZ_2K; i++) {
if (((char *)data->virtual)[i] != 'A' + i)
printf("%s: Extended receive buffer has unexpected "
"data: Start %p, Offset: %d, "
"Data=%d, expected=%d\n", __FUNCTION__,
data->virtual, i, ((char *)data->virtual)[i],
'A' + i);
return err;
}
return 0;
}
int ipc_ext_handle_pfault(struct ipc_ext_data *ipc_data,
void **virt, void **phys)
{
u32 mr[MR_UNUSED_TOTAL];
struct fault_data fault;
int err;
/* Read mrs not used by syslib */
for (int i = 0; i < MR_UNUSED_TOTAL; i++)
mr[i] = read_mr(MR_UNUSED_START + i);
fault.kdata = (fault_kdata_t *)&mr[0];
fault.sender = l4_get_sender();
/* Convert from arch-specific to generic fault data */
set_generic_fault_params(&fault);
/*
* Handle the fault using a basic logic - if a virtual index
* is faulted, map the corresponding page at same physical index.
*/
if (page_align(fault.address) == (unsigned long)virt[0]) {
if ((err = l4_map(phys[0], virt[0], 1,
MAP_USR_RW, fault.sender)) < 0) {
printf("%s: Error: l4_map failed. "
"phys=%p, virt=%p\n", __FUNCTION__,
phys[0], virt[0]);
return err;
}
} else if (page_align(fault.address) == (unsigned long)virt[1]) {
if ((err = l4_map(phys[1], virt[1], 1,
MAP_USR_RW, fault.sender)) < 0) {
printf("%s: Error: l4_map failed. "
"phys=%p, virt=%p\n", __FUNCTION__,
phys[1], virt[1]);
return err;
}
} else if (page_align(fault.address) == (unsigned long)virt[2]) {
if ((err = l4_map(phys[2], virt[2], 1,
MAP_USR_RW, fault.sender)) < 0) {
printf("%s: Error: l4_map failed. "
"phys=%p, virt=%p\n", __FUNCTION__,
phys[2], virt[2]);
return err;
}
} else if (page_align(fault.address) == (unsigned long)virt[3]) {
if ((err = l4_map(phys[3], virt[3], 1,
MAP_USR_RW, fault.sender)) < 0) {
printf("%s: Error: l4_map failed. "
"phys=%p, virt=%p\n", __FUNCTION__,
phys[3], virt[3]);
return err;
}
} else {
printf("%s: Error, page fault occured on an unexpected "
"address. adress=0x%x\n", __FUNCTION__,
fault.address);
return -1;
}
/* Reply back to fault thread and return */
return l4_ipc_return(0);
}
/*
* Create two threads who will do page-faulting ipc to each other.
* Their parent waits and handles the page faults.
*
* This test allocates 4 virtual page and 4 physical page addresses.
* It fills a total of 2KB of payload starting from the 3rd quarter
* of the first page and until the 2nd quarter of the 2nd page to
* be sent by the sender thread.
*
* The payload is copied and the pages deliberately unmapped so that
* the sender thread will page fault during the send operation.
*
* The receive pages are also set up same as above, so the receiving
* thread also faults during the receive.
*
* The main thread starts both ipc threads, and starts waiting on
* page faults. It handles the faults and the test succeeds if the
* data is transfered safely to receiving end, despite all faults.
*/
int test_ipc_extended(void)
{
struct task_ids self_ids;
struct ipc_ext_data ipc_data[2];
struct l4_thread *thread[2];
void *virt[4], *phys[4];
int err, tag;
l4_getid(&self_ids);
/* Get 4 physical pages */
for (int i = 0; i < 4; i++)
phys[i] = physical_page_new(1);
/* Get 2 pairs of virtual pages */
virt[0] = virtual_page_new(2);
virt[1] = virt[0] + PAGE_SIZE;
virt[2] = virtual_page_new(2);
virt[3] = virt[2] + PAGE_SIZE;
/* Map sender pages to self */
if ((err = l4_map(phys[0], virt[0], 1,
MAP_USR_RW, self_ids.tid)) < 0) {
printf("Error: Mapping Sender pages failed. phys: 0x%p,"
" virt: 0x%p, tid=%d, err=%d\n", phys[0], virt[0],
self_ids.tid, err);
return err;
}
if ((err = l4_map(phys[1], virt[1], 1,
MAP_USR_RW, self_ids.tid)) < 0) {
printf("Error: Mapping Sender pages failed. phys: 0x%p,"
" virt: 0x%p, tid=%d, err=%d\n", phys[0], virt[0],
self_ids.tid, err);
return err;
}
/*
* Fill them with values to be sent
* Filling in 3rd KB of first page to 2nd KB of second page
*/
for (int i = 0; i < SZ_2K; i++)
((char *)virt[0] + SZ_1K * 3)[i] = 'A' + i;
/* Unmap the pages */
l4_unmap(virt[0], 2, self_ids.tid);
/* Create ipc threads but don't start. */
if ((err = thread_create(ipc_extended_sender,
&ipc_data[0],
TC_SHARE_SPACE | TC_NOSTART,
&thread[0])) < 0) {
dbg_printf("Thread create failed. "
"err=%d\n", err);
return err;
}
dbg_printf("Thread created successfully. "
"tid=%d\n", thread[0]->ids.tid);
if ((err = thread_create(ipc_extended_receiver,
&ipc_data[1],
TC_SHARE_SPACE | TC_NOSTART,
&thread[1])) < 0) {
dbg_printf("Thread create failed. "
"err=%d\n", err);
return err;
}
dbg_printf("Thread created successfully. "
"tid=%d\n", thread[1]->ids.tid);
/*
* Set up arguments to sender,
* Send offset at 3rd quarter of first page.
*/
ipc_data[0].virtual = virt[0] + SZ_1K * 3;
ipc_data[0].partner = thread[1]->ids.tid;
/*
* Set up arguments to receiver
* Receive offset at 3rd quarter of first page.
*/
ipc_data[1].virtual = virt[1] + SZ_1K * 3;
ipc_data[1].partner = thread[0]->ids.tid;
/* Start the threads */
l4_thread_control(THREAD_RUN, &thread[0]->ids);
l4_thread_control(THREAD_RUN, &thread[1]->ids);
/* Expecting 4 faults on 4 pages */
for (int i = 0; i < 4; i++) {
/* Wait on page fault */
if ((err = l4_receive(L4_ANYTHREAD)) < 0) {
printf("Error: l4_receive() for page"
" fault has failed. err=%d\n",
err);
}
if ((tag = l4_get_tag()) != L4_IPC_TAG_PFAULT) {
printf("Error: Parent thread received "
"non-page fault ipc tag. tag=%d\n",
tag);
return -1;
}
/* Handle fault */
if ((err = ipc_ext_handle_pfault(ipc_data, virt, phys)) < 0) {
printf("Error: An error occured during ipc "
"page fault handling. err=%d\n", err);
return err;
}
}
/* Wait for the ipc threads */
for (int i = 0; i < 2; i ++)
if ((err = thread_wait(thread[i])) < 0) {
dbg_printf("THREAD_WAIT failed. "
"err=%d\n", err);
return err;
}
/* Unmap and release pages */
for (int i = 0; i < 4; i++) {
l4_unmap(virt[i], 1, self_ids.tid);
virtual_page_free(virt[i], 1);
physical_page_free(phys[i], 1);
}
return 0;
}
int ipc_full_thread(void *arg)
{
l4id_t parent = *((l4id_t *)arg);
int err;
/* Do two full send/receives */
for (int i = 0; i < 2; i++) {
/* Full receive, return positive if error */
if ((err = l4_receive_full(parent)) < 0) {
dbg_printf("Full receive failed on new "
"thread. err=%d", err);
return 1;
}
/* Test full utcb received values */
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) {
if (read_mr(i) != i) {
dbg_printf("IPC full receive on new thread: "
"Unexpected message register "
"values. MR%d = %d, should be %d\n",
i, read_mr(i), i);
return 1; /* Exit positive without reply */
}
}
/*
* Reset all message registers
*/
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++)
write_mr(i, 0);
/* Send full return reply */
l4_send_full(parent, 0);
}
return 0;
}
int ipc_short_thread(void *arg)
{
l4id_t parent = *((l4id_t *)arg);
int err;
/* Short receive, return positive if error */
if ((err = l4_receive(parent)) < 0) {
dbg_printf("Short receive failed on new "
"thread. err=%d", err);
return 1;
}
/* Test received registers */
for (int i = MR_UNUSED_START; i < MR_TOTAL; i++) {
if (read_mr(i) != i) {
dbg_printf("IPC Receive on new thread: "
"Unexpected message register "
"values.\n"
"read = %d, expected = %d\n",
read_mr(i), i);
l4_print_mrs();
return 1; /* Exit positive without reply */
}
}
/*
* Reset all message registers
*/
for (int i = MR_UNUSED_START; i < MR_TOTAL; i++)
write_mr(i, 0);
/*
* Send return reply and exit
*/
return l4_send(parent, 0);
}
/*
* Create a thread and do a full ipc to it
*/
int test_ipc_full(void)
{
struct task_ids self_ids;
struct l4_thread *thread;
int err;
l4_getid(&self_ids);
/*
* Create a thread in the same space
*/
if ((err = thread_create(ipc_full_thread,
&self_ids.tid,
TC_SHARE_SPACE,
&thread)) < 0) {
dbg_printf("Thread create failed. "
"err=%d\n", err);
return err;
}
dbg_printf("Thread created successfully. "
"tid=%d\n", thread->ids.tid);
/*
* Try one short and one full send/recv
* to test full send/recv occurs on both cases
*/
/*
* Write data to full utcb registers
*/
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++)
write_mr(i, i);
/*
* First, do a full ipc send/recv
*/
if ((err = l4_sendrecv_full(thread->ids.tid,
thread->ids.tid,
0)) < 0) {
dbg_printf("Full IPC send/recv failed. "
"err=%d\n", err);
return err;
}
/*
* Check that payload registers are modified to 0
*/
dbg_printf("%s: After send/recv:\n", __FUNCTION__);
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) {
if (read_mr(i) != 0) {
dbg_printf("Full IPC send/recv: "
"Received payload is not "
"as expected.\n "
"MR%d = %d, should be %d\n",
i, read_mr(i), 0);
return -1;
}
}
/*
* Write data to full utcb registers
*/
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++)
write_mr(i, i);
/*
* Try a short ipc send/recv. This should still result
* in full ipc since the other side is doing full send/recv.
*/
if ((err = l4_sendrecv(thread->ids.tid,
thread->ids.tid,
0)) < 0) {
dbg_printf("Full IPC send/recv failed. "
"err=%d\n", err);
return err;
}
/*
* Check that payload registers are modified to 0
*/
// dbg_printf("%s: After send/recv:\n", __FUNCTION__);
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) {
// dbg_printf("MR%d: %d\n", i, read_mr(i));
if (read_mr(i) != 0) {
dbg_printf("Full IPC send/recv: "
"Received payload is not "
"as expected.\n "
"MR%d = %d, should be %d\n",
i, read_mr(i), 0);
return -1;
}
}
/* Wait for the ipc thread to die */
if ((err = thread_wait(thread)) < 0) {
dbg_printf("THREAD_WAIT failed. "
"err=%d\n", err);
return err;
}
dbg_printf("Full IPC send/recv successful.\n");
return 0;
}
/*
* Create a thread and do a short ipc to it
*/
int test_ipc_short(void)
{
struct task_ids self_ids;
struct l4_thread *thread;
int err;
l4_getid(&self_ids);
/*
* Create a thread in the same space
*/
if ((err = thread_create(ipc_short_thread,
&self_ids.tid,
TC_SHARE_SPACE,
&thread)) < 0) {
dbg_printf("Thread create failed. "
"err=%d\n", err);
return err;
}
dbg_printf("Thread created successfully. "
"tid=%d\n", thread->ids.tid);
/*
* Write data to short ipc registers
*/
for (int i = MR_UNUSED_START; i < MR_TOTAL; i++)
write_mr(i, i);
/*
* Do short ipc send/recv and check data is reset
*/
if ((err = l4_sendrecv(thread->ids.tid,
thread->ids.tid,
0)) < 0) {
dbg_printf("Short IPC send/recv failed. "
"err=%d\n", err);
return err;
}
/*
* Check that payload registers are reset
*/
for (int i = MR_UNUSED_START; i < MR_TOTAL; i++) {
if (read_mr(i) != 0) {
dbg_printf("Short IPC send/recv: "
"Received payload is incorrect."
"read = %d, expected=%d\n",
read_mr(i), 0);
return -1;
}
}
/* Wait for the ipc thread */
if ((err = thread_wait(thread)) < 0) {
dbg_printf("THREAD_WAIT failed. "
"err=%d\n", err);
return err;
}
dbg_printf("Short IPC send/recv successful.\n");
return 0;
}
int ipc_demo(void)
{
int err;
if ((err = test_ipc_extended()) < 0)
goto out_err;
if ((err = test_ipc_short()) < 0)
goto out_err;
if ((err = test_ipc_full()) < 0)
goto out_err;
printf("IPC: -- PASSED --\n");
return 0;
out_err:
printf("IPC: -- FAILED --\n");
return err;
}

View File

@@ -0,0 +1,74 @@
/*
* ARMv7 specific functions
*
* Copyright (C) 2008 - 2010 B Labs Ltd.
*/
#include <l4lib/exregs.h>
#include <fault.h>
#include INC_SUBARCH(mm.h)
#include INC_SUBARCH(exception.h)
/* Get simplified access permissions */
int pte_get_access_simple(pte_t pte)
{
/* Place AP[2] and AP[1] in [1:0] positions and return */
return (((pte >> PTE_AP2_BIT) & 1) << 1)
| ((pte >> PTE_AP1_BIT) & 1);
}
int is_translation_fault(u32 fsr)
{
return (fsr & FSR_FS_MASK) == ABORT_TRANSLATION_PAGE;
}
unsigned int vm_prot_flags(pte_t pte, u32 fsr)
{
unsigned int pte_prot_flags = 0;
/* Translation fault means no permissions */
if (is_translation_fault(fsr))
return VM_NONE;
/* Check simplified permission bits */
switch (pte_get_access_simple(pte)) {
case AP_SIMPLE_USER_RW_KERN_RW:
pte_prot_flags |= VM_WRITE;
case AP_SIMPLE_USER_RO_KERN_RO:
pte_prot_flags |= VM_READ;
/* Also, check exec never bit */
if (!(pte & (1 << PTE_XN_BIT)))
pte_prot_flags |= VM_EXEC;
break;
case AP_SIMPLE_USER_NONE_KERN_RW:
case AP_SIMPLE_USER_NONE_KERN_RO:
default:
pte_prot_flags = VM_NONE;
break;
}
return pte_prot_flags;
}
void set_generic_fault_params(struct fault_data *fault)
{
fault->pte_flags = vm_prot_flags(fault->kdata->pte, fault->kdata->fsr);
fault->reason = 0;
/*
* Prefetch fault denotes exec fault.
*/
if (is_prefetch_abort(fault->kdata->fsr)) {
fault->reason |= VM_EXEC;
fault->address = fault->kdata->faulty_pc;
} else {
fault->address = fault->kdata->far;
/* Write-not-read bit determines fault */
if (fault->kdata->fsr & (1 << DFSR_WNR_BIT))
fault->reason |= VM_WRITE;
else
fault->reason |= VM_READ;
}
}

View File

@@ -0,0 +1,12 @@
# Inherit global environment
Import('env')
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
src_local += Glob('src/arch/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -7,64 +7,51 @@
import os, shelve, sys import os, shelve, sys
from os.path import * from os.path import *
PROJRELROOT = '../..' CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
sys.path.append(PROJRELROOT) from scripts.config.projpaths import *
from scripts.config.configuration import *
from config.projpaths import * from scripts.conts.containers import *
from config.configuration import * from scripts.config.config_invoke import *
from configure import *
config = configuration_retrieve() config = configuration_retrieve()
arch = config.arch
platform = config.platform
gcc_arch_flag = config.gcc_arch_flag gcc_arch_flag = config.gcc_arch_flag
# Wrapper library for system calls cid = int(ARGUMENTS.get('cid', 0))
LIBL4_RELDIR = 'conts/libl4' cont = find_container_from_cid(cid)
KERNEL_INCLUDE = join(PROJROOT, 'include')
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
# Some user-space libraries builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
LIBC_RELDIR = 'conts/libc'
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
join(LIBC_DIR, 'include/arch' + '/' + arch)]
LIBDEV_RELDIR = 'conts/libdev' # linker.lds is generated either in conts/xxx or build/contx/include
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) if cont.duplicate == 0:
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') linker_lds = join(builddir, 'include/linker.lds')
LIBDEV_INCLUDE = join(LIBDEV_DIR, 'include') else:
linker_lds = 'include/linker.lds'
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
LIBMEM_INCLUDE = LIBMEM_DIR
env = Environment(CC = config.toolchain_userspace + 'gcc', env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk(). # such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \ CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag], \ '-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"],\ LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'], \ ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', \ LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace',
'libmm', 'libmc', 'libmalloc', 'gcc', 'c-userspace'], 'libmem', 'gcc', 'c-userspace'],
# libgcc.a - This is required for division routines. # libgcc.a - This is required for division routines.
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, \ CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
LIBC_INCLUDE, LIBMEM_INCLUDE], LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH], LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
src = Glob('*.[cS]') objs = SConscript('SConscript', exports = { 'env' : env },
src += Glob('src/*.[cS]') duplicate=0, build_dir = builddir)
src += Glob('src/arch/*.[cS]')
objs = env.Object(src) Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program('main.elf', objs)
Depends(prog, 'include/linker.lds') prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, linker_lds)

View File

@@ -7,6 +7,7 @@
#include <l4lib/init.h> #include <l4lib/init.h>
#include <l4lib/utcb.h> #include <l4lib/utcb.h>
#include <l4lib/lib/thread.h> #include <l4lib/lib/thread.h>
#include <l4lib/lib/cap.h>
void main(void); void main(void);
@@ -18,6 +19,8 @@ void __container_init(void)
/* Thread library initialisation */ /* Thread library initialisation */
__l4_threadlib_init(); __l4_threadlib_init();
__l4_capability_init();
/* Entry to main */ /* Entry to main */
main(); main();
} }

View File

@@ -4,15 +4,16 @@
#ifndef __KEYBOARD_H__ #ifndef __KEYBOARD_H__
#define __KEYBOARD_H__ #define __KEYBOARD_H__
#include <libdev/kmi.h> #include <dev/kmi.h>
/* /*
* Keyboard structure * Keyboard structure
*/ */
struct keyboard { struct keyboard {
unsigned long base; /* Virtual base address */ unsigned long base; /* Virtual base address */
struct capability cap; /* Capability describing keyboard */
struct keyboard_state state; struct keyboard_state state;
unsigned long phys_base; /* Physical address of device */
int irq_no; /* IRQ number of device */
}; };
#endif /* __KEYBOARD_H__ */ #endif /* __KEYBOARD_H__ */

View File

@@ -9,7 +9,8 @@
*/ */
struct mouse { struct mouse {
unsigned long base; /* Virtual base address */ unsigned long base; /* Virtual base address */
struct capability cap; /* Capability describing keyboard */ unsigned long phys_base; /* Physical address of device */
int irq_no; /* IRQ number of device */
}; };
#endif /* __MOUSE_H__ */ #endif /* __MOUSE_H__ */

View File

@@ -3,6 +3,7 @@
*/ */
#include <l4lib/lib/addr.h> #include <l4lib/lib/addr.h>
#include <l4lib/lib/thread.h> #include <l4lib/lib/thread.h>
#include <l4lib/lib/cap.h>
#include <l4lib/irq.h> #include <l4lib/irq.h>
#include <l4lib/ipcdefs.h> #include <l4lib/ipcdefs.h>
#include <l4/api/errno.h> #include <l4/api/errno.h>
@@ -10,47 +11,22 @@
#include <l4/api/capability.h> #include <l4/api/capability.h>
#include <l4/generic/cap-types.h> #include <l4/generic/cap-types.h>
#include <l4/api/space.h> #include <l4/api/space.h>
#include <malloc/malloc.h> #include <mem/malloc.h>
#include <container.h> #include <container.h>
#include <linker.h> #include <linker.h>
#include <keyboard.h> #include <keyboard.h>
#include <mouse.h> #include <mouse.h>
#include <dev/platform.h>
#define KEYBOARDS_TOTAL 1 #define KEYBOARDS_TOTAL 1
#define MOUSE_TOTAL 1 #define MOUSE_TOTAL 1
static struct capability caparray[32]; static struct capability *caparray;
static int total_caps = 0; static int total_caps = 0;
struct keyboard kbd[KEYBOARDS_TOTAL]; struct keyboard kbd[KEYBOARDS_TOTAL];
struct mouse mouse[MOUSE_TOTAL]; struct mouse mouse[MOUSE_TOTAL];
int cap_read_all()
{
int ncaps;
int err;
/* Read number of capabilities */
if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
0, &ncaps)) < 0) {
printf("l4_capability_control() reading # of"
" capabilities failed.\n Could not "
"complete CAP_CONTROL_NCAPS request.\n");
BUG();
}
total_caps = ncaps;
/* Read all capabilities */
if ((err = l4_capability_control(CAP_CONTROL_READ,
0, caparray)) < 0) {
printf("l4_capability_control() reading of "
"capabilities failed.\n Could not "
"complete CAP_CONTROL_READ_CAPS request.\n");
BUG();
}
return 0;
}
int cap_share_all_with_space() int cap_share_all_with_space()
{ {
int err; int err;
@@ -68,47 +44,6 @@ int cap_share_all_with_space()
return 0; return 0;
} }
/*
* Scans for up to KEYBOARDS_TOTAL
* keyboard devices and MOUSE_TOTAL mouse
* in capabilities.
*/
int kmi_probe_devices(void)
{
int keyboards = 0, nmouse = 0;
/* Scan for timer devices */
for (int i = 0; i < total_caps; i++) {
/* Match device type */
if (cap_devtype(&caparray[i]) == CAP_DEVTYPE_KEYBOARD) {
/* Copy to correct device index */
memcpy(&kbd[cap_devnum(&caparray[i])].cap,
&caparray[i], sizeof(kbd[0].cap));
keyboards++;
}
if (cap_devtype(&caparray[i]) == CAP_DEVTYPE_MOUSE) {
/* Copy to correct device index */
memcpy(&mouse[cap_devnum(&caparray[i])].cap,
&caparray[i], sizeof(mouse[0].cap));
nmouse++;
}
}
if (keyboards != KEYBOARDS_TOTAL) {
printf("%s: Error, not all keyboards could be found. "
"keyboards=%d\n", __CONTAINER_NAME__, keyboards);
return -ENODEV;
}
if (nmouse != MOUSE_TOTAL) {
printf("%s: Error, not all mouse could be found. "
"mouse=%d\n", __CONTAINER_NAME__, nmouse);
return -ENODEV;
}
return 0;
}
int keyboard_irq_handler(void *arg) int keyboard_irq_handler(void *arg)
{ {
int err; int err;
@@ -125,7 +60,7 @@ int keyboard_irq_handler(void *arg)
/* Register self for timer irq, using notify slot 0 */ /* Register self for timer irq, using notify slot 0 */
if ((err = l4_irq_control(IRQ_CONTROL_REGISTER, slot, if ((err = l4_irq_control(IRQ_CONTROL_REGISTER, slot,
keyboard->cap.irq)) < 0) { keyboard->irq_no)) < 0) {
printf("%s: FATAL: Keyboard irq could not be registered. " printf("%s: FATAL: Keyboard irq could not be registered. "
"err=%d\n", __FUNCTION__, err); "err=%d\n", __FUNCTION__, err);
BUG(); BUG();
@@ -136,7 +71,7 @@ int keyboard_irq_handler(void *arg)
char c; char c;
/* Block on irq */ /* Block on irq */
int data = l4_irq_wait(slot, keyboard->cap.irq); int data = l4_irq_wait(slot, keyboard->irq_no);
while (data--) while (data--)
if ((c = kmi_keyboard_read(keyboard->base, &keyboard->state))) if ((c = kmi_keyboard_read(keyboard->base, &keyboard->state)))
printf("%c", c); printf("%c", c);
@@ -165,7 +100,7 @@ int mouse_irq_handler(void *arg)
/* Register self for timer irq, using notify slot 0 */ /* Register self for timer irq, using notify slot 0 */
if ((err = l4_irq_control(IRQ_CONTROL_REGISTER, slot, if ((err = l4_irq_control(IRQ_CONTROL_REGISTER, slot,
mouse->cap.irq)) < 0) { mouse->irq_no)) < 0) {
printf("%s: FATAL: Mouse irq could not be registered. " printf("%s: FATAL: Mouse irq could not be registered. "
"err=%d\n", __FUNCTION__, err); "err=%d\n", __FUNCTION__, err);
BUG(); BUG();
@@ -176,7 +111,7 @@ int mouse_irq_handler(void *arg)
int c; int c;
/* Block on irq */ /* Block on irq */
int data = l4_irq_wait(slot, mouse->cap.irq); int data = l4_irq_wait(slot, mouse->irq_no);
while (data--) while (data--)
if ((c = kmi_data_read(mouse->base))) if ((c = kmi_data_read(mouse->base)))
printf("mouse data: %d\n", c); printf("mouse data: %d\n", c);
@@ -195,6 +130,9 @@ int kmi_setup_devices(void)
struct l4_thread *tptr = &thread; struct l4_thread *tptr = &thread;
int err; int err;
kbd[0].phys_base = PLATFORM_KEYBOARD0_BASE;
kbd[0].irq_no = IRQ_KEYBOARD0;
for (int i = 0; i < KEYBOARDS_TOTAL; i++) { for (int i = 0; i < KEYBOARDS_TOTAL; i++) {
/* Get one page from address pool */ /* Get one page from address pool */
kbd[i].base = (unsigned long)l4_new_virtual(1); kbd[i].base = (unsigned long)l4_new_virtual(1);
@@ -203,13 +141,12 @@ int kmi_setup_devices(void)
kbd[i].state.keyup = 0; kbd[i].state.keyup = 0;
/* Map timer to a virtual address region */ /* Map timer to a virtual address region */
if (IS_ERR(l4_map((void *)__pfn_to_addr(kbd[i].cap.start), if (IS_ERR(l4_map((void *)kbd[i].phys_base,
(void *)kbd[i].base, kbd[i].cap.size, (void *)kbd[i].base, 1,
MAP_USR_IO, self_tid()))) { MAP_USR_IO, self_tid()))) {
printf("%s: FATAL: Failed to map Keyboard device " printf("%s: FATAL: Failed to map Keyboard device "
"%d to a virtual address\n", "to a virtual address\n",
__CONTAINER_NAME__, __CONTAINER_NAME__);
cap_devnum(&kbd[i].cap));
BUG(); BUG();
} }
@@ -229,17 +166,20 @@ int kmi_setup_devices(void)
} }
} }
mouse[0].phys_base = PLATFORM_MOUSE0_BASE;
mouse[0].irq_no = IRQ_MOUSE0;
for (int i = 0; i < MOUSE_TOTAL; i++) { for (int i = 0; i < MOUSE_TOTAL; i++) {
/* Get one page from address pool */ /* Get one page from address pool */
mouse[i].base = (unsigned long)l4_new_virtual(1); mouse[i].base = (unsigned long)l4_new_virtual(1);
/* Map timer to a virtual address region */ /* Map timer to a virtual address region */
if (IS_ERR(l4_map((void *)__pfn_to_addr(mouse[i].cap.start), if (IS_ERR(l4_map((void *)mouse[i].phys_base,
(void *)mouse[i].base, mouse[i].cap.size, (void *)mouse[i].base, 1,
MAP_USR_IO, self_tid()))) { MAP_USR_IO, self_tid()))) {
printf("%s: FATAL: Failed to map Mouse device " printf("%s: FATAL: Failed to map Mouse device "
"%d to a virtual address\n", "to a virtual address\n",
__CONTAINER_NAME__, cap_devnum(&mouse[i].cap)); __CONTAINER_NAME__);
BUG(); BUG();
} }
@@ -368,64 +308,20 @@ void handle_requests(void)
} }
} }
/*
* UTCB-size aligned utcb.
*
* BIG WARNING NOTE: This declaration is legal if we are
* running in a disjoint virtual address space, where the
* utcb declaration lies in a unique virtual address in
* the system.
*/
#define DECLARE_UTCB(name) \
struct utcb name ALIGN(sizeof(struct utcb))
DECLARE_UTCB(utcb);
/* Set up own utcb for ipc */
int l4_utcb_setup(void *utcb_address)
{
struct task_ids ids;
struct exregs_data exregs;
int err;
l4_getid(&ids);
/* Clear utcb */
memset(utcb_address, 0, sizeof(struct utcb));
/* Setup exregs for utcb request */
memset(&exregs, 0, sizeof(exregs));
exregs_set_utcb(&exregs, (unsigned long)utcb_address);
if ((err = l4_exchange_registers(&exregs, ids.tid)) < 0)
return err;
return 0;
}
void main(void) void main(void)
{ {
int err;
/* Read all capabilities */ /* Read all capabilities */
cap_read_all(); caps_read_all();
total_caps = cap_get_count();
caparray = cap_get_all();
/* Share all with space */ /* Share all with space */
cap_share_all_with_space(); cap_share_all_with_space();
/* Scan for keyboard devices in capabilities */
kmi_probe_devices();
/* Initialize virtual address pool for timers */ /* Initialize virtual address pool for timers */
init_vaddr_pool(); init_vaddr_pool();
/* Setup own static utcb */
if ((err = l4_utcb_setup(&utcb)) < 0) {
printf("FATAL: Could not set up own utcb. "
"err=%d\n", err);
BUG();
}
/* Map and initialize keyboard devices */ /* Map and initialize keyboard devices */
kmi_setup_devices(); kmi_setup_devices();

View File

@@ -0,0 +1,11 @@
# Inherit global environment
Import('env')
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -0,0 +1,57 @@
# -*- mode: python; coding: utf-8; -*-
#
# Codezero -- Virtualization microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
import os, shelve, sys
from os.path import *
CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
from scripts.config.projpaths import *
from scripts.conts.containers import *
from scripts.config.configuration import *
config = configuration_retrieve()
gcc_arch_flag = config.gcc_arch_flag
cid = int(ARGUMENTS.get('cid', 0))
cont = find_container_from_cid(cid)
builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
# linker.lds is generated either in conts/xxx or build/contx/include
if cont.duplicate == 0:
linker_lds = join(builddir, 'include/linker.lds')
else:
linker_lds = 'include/linker.lds'
env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace',
'libmem', 'gcc', 'c-userspace'],
# libgcc.a - This is required for division routines.
CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h \
-include l4/types.h -include l4lib/macros.h')
objs = SConscript('SConscript', exports = { 'env' : env },
duplicate=0, build_dir = builddir)
Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, linker_lds)

View File

@@ -0,0 +1,21 @@
/*
* Container entry point for pager
*
* Copyright (C) 2007-2009 B Labs Ltd.
*/
#include <l4lib/init.h>
#include <l4lib/utcb.h>
extern void main(void);
void __container_init(void)
{
/* Generic L4 initialisation */
__l4_init();
/* Entry to main */
main();
}

View File

@@ -0,0 +1,13 @@
#ifndef __TESTS_H__
#define __TESTS_H__
//#define DEBUG
#ifdef DEBUG
#define dgb_printf printf
#else
#define dbg_printf(fmt,...)
#endif
#endif

View File

@@ -0,0 +1,18 @@
/*
* Main function for this container
*/
#include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syslib.h)
#include L4LIB_INC_ARCH(syscalls.h)
#include <l4/api/space.h>
extern int test_api_mutexctrl(void);
int main(void)
{
test_api_mutexctrl();
return 0;
}

View File

@@ -0,0 +1,23 @@
# Inherit global environment
Import('env')
from scripts.config.configuration import *
config = configuration_retrieve()
arch = config.arch
subarch = config.subarch
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
src_local += Glob('src/arch/' + arch + '/*.[cS]')
src_local += Glob('src/api/*.c');
src_local += Glob('src/perf/*.c');
src_local += Glob('src/cli_serv/*.c');
src_local += Glob('src/mthread/*.c');
src_local += Glob('src/arch/' + arch + '/' + subarch + '/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -7,61 +7,49 @@
import os, shelve, sys import os, shelve, sys
from os.path import * from os.path import *
PROJRELROOT = '../..' CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
sys.path.append(PROJRELROOT) from scripts.config.projpaths import *
from scripts.conts.containers import *
from config.projpaths import * from scripts.config.configuration import *
from config.configuration import *
from config.lib import *
config = configuration_retrieve() config = configuration_retrieve()
arch = config.arch
platform = config.platform
gcc_arch_flag = config.gcc_arch_flag gcc_arch_flag = config.gcc_arch_flag
LIBL4_RELDIR = 'conts/libl4' cid = int(ARGUMENTS.get('cid', 0))
KERNEL_INCLUDE = join(PROJROOT, 'include') cont = find_container_from_cid(cid)
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
# Locally important paths are here builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
LIBC_RELDIR = 'conts/libc'
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
join(LIBC_DIR, 'include/arch' + '/' + arch)]
LIBDEV_RELDIR = 'conts/libdev' # linker.lds is generated either in conts/xxx or build/contx/include
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) if cont.duplicate == 0:
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') linker_lds = join(builddir, 'include/linker.lds')
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')] else:
linker_lds = 'include/linker.lds'
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
LIBMEM_INCLUDE = LIBMEM_DIR
env = Environment(CC = config.toolchain_userspace + 'gcc', env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk(). # such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \ CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag], '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"],\ LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'], \ ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable\ PROGSUFFIX = '.elf',
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path\ ENV = {'PATH' : os.environ['PATH']},
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', 'gcc', 'libmalloc', LIBS = ['gcc', 'libl4', 'libmem', 'c-userspace', 'libdev-userspace',
'c-userspace'], # libgcc.a - This is required for division routines. 'gcc', 'c-userspace'],
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE, LIBMEM_INCLUDE], # libgcc.a - This is required for division routines.
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH], CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
src = Glob('*.[cS]') objs = SConscript('SConscript', exports = { 'env' : env },
src += Glob('src/*.[cS]') duplicate=0, build_dir = builddir)
src += Glob('src/arch/*.[cS]')
objs = env.Object(src) Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program('main.elf', objs) prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, 'include/linker.lds') Depends(prog, linker_lds)

View File

@@ -0,0 +1,257 @@
main.c,65
void run_tests(void)run_tests16,287
int main(void)main38,770
src/capability.c,0
src/example.c,0
src/cli_serv/cli_serv.c,45
int test_cli_serv(void)test_cli_serv21,536
src/api/cap.c,192
#define TOTAL_CAPS TOTAL_CAPS12,202
struct capability cap_array[TOTAL_CAPS];cap_array14,228
int test_cap_read(void)test_cap_read19,308
int test_api_capctrl(void)test_api_capctrl47,968
src/api/exregs.c,113
int test_exregs_read_write(void)test_exregs_read_write15,229
int test_api_exregs(void)test_api_exregs76,1453
src/api/memory.c,771
#define DECLARE_IDPOOL(DECLARE_IDPOOL23,461
struct address_pool virtual_page_pool, physical_page_pool;virtual_page_pool26,558
struct address_pool virtual_page_pool, physical_page_pool;physical_page_pool26,558
#define PAGE_POOL_SIZE PAGE_POOL_SIZE28,618
#define virt_to_phys(virt_to_phys33,750
#define phys_to_virt(phys_to_virt34,833
#define TEST_POOL_TOTAL TEST_POOL_TOTAL37,920
void test_page_pool(void)test_page_pool41,972
void page_pool_init(void)page_pool_init106,2602
void *virtual_page_new(int npages)virtual_page_new177,4779
void *physical_page_new(int npages)physical_page_new182,4879
void virtual_page_free(void *address, int npages)virtual_page_free187,4981
void physical_page_free(void *address, int npages)physical_page_free193,5104
src/api/cache.c,158
int test_cctrl_basic(void)test_cctrl_basic18,348
int test_cctrl_sync_caches()test_cctrl_sync_caches43,971
int test_api_cctrl(void)test_api_cctrl64,1314
src/api/thread.c,517
int new_thread_func(void *args)new_thread_func18,285
int delayed_exit_func(void *args)delayed_exit_func32,614
int imm_exit_func(void *args)imm_exit_func54,1031
struct l4_thread *test_thread_create()test_thread_create62,1132
int test_thread_actions(struct l4_thread *thread)test_thread_actions92,1698
int test_thread_destroy(struct l4_thread *thread)test_thread_destroy126,2347
int test_thread_invalid(struct l4_thread *thread)test_thread_invalid214,4305
int test_api_tctrl(void)test_api_tctrl219,4371
src/api/api.c,35
int test_api(void)test_api15,214
src/api/irq.c,50
int test_api_irqctrl(void)test_api_irqctrl8,105
src/api/ipc.c,705
struct ipc_ext_data {ipc_ext_data18,330
void *virtual; /* Virtual address to start ipc from */virtual19,352
l4id_t partner; /* Partner to do extended ipc */partner20,408
int ipc_extended_sender(void *arg)ipc_extended_sender23,462
int ipc_extended_receiver(void *arg)ipc_extended_receiver36,722
int ipc_ext_handle_pfault(struct ipc_ext_data *ipc_data,ipc_ext_handle_pfault63,1348
int test_ipc_extended(void)test_ipc_extended146,4092
int ipc_full_thread(void *arg)ipc_full_thread276,7400
int ipc_short_thread(void *arg)ipc_short_thread313,8275
int test_ipc_full(void)test_ipc_full354,9106
int test_ipc_short(void)test_ipc_short462,11483
int test_api_ipc(void)test_api_ipc526,12763
src/api/map.c,305
#define KERNEL_PAGE KERNEL_PAGE15,277
#define KIP_PAGE KIP_PAGE16,311
#define SYSCALL_PAGE SYSCALL_PAGE17,342
#define VECTOR_PAGE VECTOR_PAGE18,377
int test_api_map(void)test_api_map20,412
int test_api_unmap(void)test_api_unmap259,6043
int test_api_map_unmap(void)test_api_map_unmap347,8064
src/api/getid.c,167
int thread_getid_nullptr(void *arg)thread_getid_nullptr15,250
int test_getid_nullptr(void)test_getid_nullptr27,479
int test_api_getid(void)test_api_getid84,1734
src/api/smp.c,299
static int new_thread_func(void *args)new_thread_func14,232
int test_smp_two_threads(void)test_smp_two_threads48,945
int test_smp_two_spaces(void)test_smp_two_spaces113,2491
int test_smp_ipc(void)test_smp_ipc118,2537
int test_smp(void)test_smp124,2601
int test_smp(void)test_smp141,2833
src/api/mutex.c,652
#define MUTEX_NTHREADS MUTEX_NTHREADS16,283
#define MUTEX_INCREMENTS MUTEX_INCREMENTS17,310
#define MUTEX_VALUE_TOTAL MUTEX_VALUE_TOTAL18,340
struct mutex_test_data {mutex_test_data20,404
struct l4_mutex lock;lock21,429
int val;val22,452
static struct mutex_test_data tdata;tdata25,466
static void init_test_data(struct mutex_test_data *tdata)init_test_data27,504
int mutex_thread_non_contending(void *arg)mutex_thread_non_contending34,615
int mutex_thread_contending(void *arg)mutex_thread_contending67,1270
int test_mutex(int (*mutex_thread)(void *))test_mutex106,2054
int test_api_mutexctrl(void)test_api_mutexctrl187,3891
src/captest.c,178
int simple_pager_thread(void *arg)simple_pager_thread10,204
int wait_check_test(struct task_ids *ids)wait_check_test57,1151
int capability_test(void)capability_test74,1490
src/perf/tctrl.c,174
struct perfmon_cycles tctrl_cycles;tctrl_cycles18,324
#define PERFTEST_THREAD_CREATE PERFTEST_THREAD_CREATE20,361
void perf_measure_tctrl(void)perf_measure_tctrl22,399
src/perf/exregs.c,181
struct perfmon_cycles l4_exregs_cycles;l4_exregs_cycles19,372
#define PERFTEST_EXREGS_COUNT PERFTEST_EXREGS_COUNT21,413
int perf_measure_exregs(void)perf_measure_exregs23,449
src/perf/tswitch.c,472
struct perfmon_cycles thread_switch_cycles;thread_switch_cycles18,324
struct perfmon_cycles space_switch_cycles;space_switch_cycles19,368
static int indicate_switch = 0;indicate_switch21,412
void thread_switcher_thread(void *arg)thread_switcher_thread23,445
void perf_measure_thread_switch(void)perf_measure_thread_switch39,799
void perf_measure_space_switch(void)perf_measure_space_switch102,2328
void perf_measure_tswitch(void)perf_measure_tswitch108,2372
src/perf/perf.c,51
int test_performance(void)test_performance15,204
src/perf/simple.c,168
struct perfmon_cycles simple_cycles;simple_cycles17,314
#define PERFTEST_SIMPLE_LOOP PERFTEST_SIMPLE_LOOP19,352
void perf_test_simple(void)perf_test_simple21,387
src/perf/ipc.c,51
void perf_measure_ipc(void)perf_measure_ipc9,102
src/perf/map.c,107
void perf_measure_map(void)perf_measure_map9,111
void perf_measure_unmap(void)perf_measure_unmap14,145
src/perf/getid.c,245
struct perfmon_cycles l4_getid_cycles;l4_getid_cycles18,333
#define PERFTEST_GETID_COUNT PERFTEST_GETID_COUNT20,373
void perf_measure_getid_ticks(void)perf_measure_getid_ticks25,450
void perf_measure_getid(void)perf_measure_getid67,1461
src/perf/timer.c,150
#define TIMER_PHYSICAL_BASE TIMER_PHYSICAL_BASE15,298
unsigned long timer_base;timer_base17,339
void perf_timer_init(void)perf_timer_init19,366
src/perf/mutex.c,55
void perf_measure_mutex(void)perf_measure_mutex9,104
src/perf/cycles.c,70
void platform_measure_cpu_cycles()platform_measure_cpu_cycles20,354
src/mthread/mthread.c,43
int test_mthread(void)test_mthread22,547
src/arch/arm/v7/mm.c,285
int pte_get_access_simple(pte_t pte)pte_get_access_simple13,246
int is_translation_fault(u32 fsr)is_translation_fault20,427
unsigned int vm_prot_flags(pte_t pte, u32 fsr)vm_prot_flags25,521
void set_generic_fault_params(struct fault_data *fault)set_generic_fault_params54,1163
src/arch/arm/v5/mm.c,147
unsigned int vm_prot_flags(pte_t pte)vm_prot_flags12,242
void set_generic_fault_params(struct fault_data *fault)set_generic_fault_params42,960
container.c,52
void __container_init(void)__container_init14,216
include/capability.h,47
#define __CAPABILITY_H____CAPABILITY_H__2,25
include/thread.h,121
#define __THREAD_H____THREAD_H__2,21
#define STACK_SIZE STACK_SIZE15,318
#define THREADS_TOTAL THREADS_TOTAL17,345
include/memory.h,59
#define __TESTSUITE_MEMORY_H____TESTSUITE_MEMORY_H__2,31
include/fault.h,840
#define __FAULT_H____FAULT_H__2,20
#define VM_NONE VM_NONE10,169
#define VM_READ VM_READ11,197
#define VM_EXEC VM_EXEC12,225
#define VM_WRITE VM_WRITE13,253
#define VM_PROT_MASK VM_PROT_MASK14,281
#define VMA_SHARED VMA_SHARED17,364
#define VMA_ANONYMOUS VMA_ANONYMOUS19,459
#define VMA_PRIVATE VMA_PRIVATE21,521
#define VMA_FIXED VMA_FIXED23,574
#define VMA_GROWSDOWN VMA_GROWSDOWN25,651
#define VM_DIRTY VM_DIRTY28,751
struct fault_data {fault_data31,842
fault_kdata_t *kdata; /* Generic data forged by the kernel */kdata32,862
unsigned int reason; /* Generic fault reason flags */reason33,926
unsigned int address; /* Aborted address */address34,982
unsigned int pte_flags; /* Generic protection flags on pte */pte_flags35,1028
l4id_t sender; /* Inittask-related fault data */sender36,1092
include/macros.h,201
#define __TEST_MACROS_H____TEST_MACROS_H__2,26
#define __INC_ARCH(__INC_ARCH4,53
#define __INC_SUBARCH(__INC_SUBARCH5,94
#define __INC_PLAT(__INC_PLAT6,149
#define __INC_GLUE(__INC_GLUE7,198
include/timer.h,59
#define __PERF_TESTS_TIMER_H____PERF_TESTS_TIMER_H__2,31
include/perf.h,740
#define __PERF_TESTS_H____PERF_TESTS_H__2,25
struct perfmon_cycles {perfmon_cycles9,192
u64 last; /* Last op cycles */last10,216
u64 min; /* Minimum cycles */min11,248
u64 max; /* Max cycles */max12,279
u64 avg; /* Average cycles */avg13,306
u64 total; /* Total cycles */total14,337
u64 ops; /* Total ops */ops15,368
#define CORTEXA9_400MHZ_USEC CORTEXA9_400MHZ_USEC26,614
#define CORTEXA9_400MHZ_MSEC CORTEXA9_400MHZ_MSEC27,654
#define USEC_MULTIPLIER USEC_MULTIPLIER28,697
#define MSEC_MULTIPLIER MSEC_MULTIPLIER29,743
#define perfmon_record_cycles(perfmon_record_cycles34,832
#define perfmon_record_cycles(perfmon_record_cycles38,919
#define perfmon_checkpoint_cycles(perfmon_checkpoint_cycles50,1261
include/api/api.h,55
#define __TEST_SUITE_API_H____TEST_SUITE_API_H__2,29
include/debug.h,432
#define __ARCH_DEBUG_H____ARCH_DEBUG_H__7,111
static inline u32 perfmon_read_cyccnt() { return 0; }perfmon_read_cyccnt14,250
static inline void perfmon_reset_start_cyccnt() { }perfmon_reset_start_cyccnt16,305
static inline u32 perfmon_read_reset_start_cyccnt() { return 0; }perfmon_read_reset_start_cyccnt17,357
#define debug_record_cycles(debug_record_cycles19,424
#define debug_record_cycles(debug_record_cycles33,763
include/tests.h,149
#define __TESTS_H____TESTS_H__2,20
#define DEBUG_TESTS DEBUG_TESTS5,74
#define dbg_printf(dbg_printf7,112
#define dbg_printf(dbg_printf9,162
include/linker.h,61
#define __TEST_SUITE_LINKER_H____TEST_SUITE_LINKER_H__2,32

View File

@@ -6,7 +6,8 @@
#include <l4lib/init.h> #include <l4lib/init.h>
#include <l4lib/utcb.h> #include <l4lib/utcb.h>
#include <l4lib/lib/thread.h>
#include <l4lib/lib/cap.h>
extern void main(void); extern void main(void);
@@ -15,6 +16,12 @@ void __container_init(void)
/* Generic L4 initialisation */ /* Generic L4 initialisation */
__l4_init(); __l4_init();
/* Thread library initialisation */
__l4_threadlib_init();
/* Capability library initialization */
__l4_capability_init();
/* Entry to main */ /* Entry to main */
main(); main();
} }

View File

@@ -0,0 +1,44 @@
#ifndef __FAULT_H__
#define __FAULT_H__
#include <l4/macros.h>
#include <l4/types.h>
#include INC_GLUE(memory.h)
#include INC_ARCH(exception.h)
/* Protection flags */
#define VM_NONE (1 << 0)
#define VM_READ (1 << 1)
#define VM_EXEC (1 << 2)
#define VM_WRITE (1 << 3)
#define VM_PROT_MASK (VM_READ | VM_WRITE | VM_EXEC)
/* Shared copy of a file */
#define VMA_SHARED (1 << 4)
/* VMA that's not file-backed, always maps devzero as VMA_COW */
#define VMA_ANONYMOUS (1 << 5)
/* Private copy of a file */
#define VMA_PRIVATE (1 << 6)
/* For wired pages */
#define VMA_FIXED (1 << 7)
/* For stack, where mmap returns end address */
#define VMA_GROWSDOWN (1 << 8)
/* Set when the page is dirty in cache but not written to disk */
#define VM_DIRTY (1 << 9)
/* Fault data specific to this task + ptr to kernel's data */
struct fault_data {
fault_kdata_t *kdata; /* Generic data forged by the kernel */
unsigned int reason; /* Generic fault reason flags */
unsigned int address; /* Aborted address */
unsigned int pte_flags; /* Generic protection flags on pte */
l4id_t sender; /* Inittask-related fault data */
};
void set_generic_fault_params(struct fault_data *fault);
void arch_print_fault_params(struct fault_data *fault);
void fault_handle_error(struct fault_data *fault);
#endif /* __FAULT_H__ */

View File

@@ -0,0 +1,16 @@
#ifndef __TEST_SUITE_LINKER_H__
#define __TEST_SUITE_LINKER_H__
extern unsigned char __stack[];
extern unsigned char __end[];
extern unsigned char vma_start[];
extern unsigned char lma_start[];
extern unsigned char offset[];
extern unsigned char __data_start[];
extern unsigned char __data_end[];
extern unsigned char __bss_start[];
extern unsigned char __bss_end[];
extern unsigned char __stack_start[];
extern unsigned char __stack_end[];
#endif /* __LINKER_H__ */

View File

@@ -0,0 +1,12 @@
#ifndef __TESTSUITE_MEMORY_H__
#define __TESTSUITE_MEMORY_H__
void *virtual_page_new(int npages);
void *physical_page_new(int npages);
void virtual_page_free(void *address, int npages);
void physical_page_free(void *address, int npages);
void page_pool_init(void);
#endif /* __TESTSUITE_MEMORY_H__ */

View File

@@ -1,7 +1,18 @@
#ifndef __TESTS_H__ #ifndef __TESTS_H__
#define __TESTS_H__ #define __TESTS_H__
/* Abort debugging conditions */
#define DEBUG_TESTS 0
#if DEBUG_TESTS
#define dbg_printf(...) printf(__VA_ARGS__)
#else
#define dbg_printf(...)
#endif
int capability_test(void); int test_smp();
int test_performance();
int test_api();
int test_cli_serv();
int test_mthread();
#endif /* __TESTS_H__ */ #endif /* __TESTS_H__ */

View File

@@ -1,7 +1,7 @@
#ifndef __PERF_TESTS_TIMER_H__ #ifndef __PERF_TESTS_TIMER_H__
#define __PERF_TESTS_TIMER_H__ #define __PERF_TESTS_TIMER_H__
#include <libdev/timer.h> #include <dev/timer.h>
extern unsigned long timer_base; extern unsigned long timer_base;
void perf_timer_init(void); void perf_timer_init(void);

View File

@@ -3,62 +3,41 @@
* *
* Copyright (C) 2009 B Labs Ltd. * Copyright (C) 2009 B Labs Ltd.
*/ */
#include <l4/api/errno.h>
#include <container.h>
#include <thread.h>
#include <tests.h>
#include <l4lib/macros.h> #include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syslib.h) #include L4LIB_INC_ARCH(syslib.h)
#include L4LIB_INC_ARCH(syscalls.h) #include L4LIB_INC_ARCH(syscalls.h)
#include <tests.h>
#include <thread.h>
#include <container.h>
#include <l4/api/space.h> #include <l4/api/space.h>
#include <l4/api/errno.h>
int exit_test_thread(void *arg) void run_tests(void)
{ {
while (1)
;
//l4_thread_switch(0);
//l4_exit(5);
return 0;
}
int exit_test(void)
{
int ret;
struct task_ids ids;
/* Create and run a new thread */
if ((ret = thread_create(exit_test_thread, 0,
TC_SHARE_SPACE | TC_AS_PAGER,
&ids)) < 0) {
printf("Top-level simple_pager creation failed.\n");
goto out_err;
} else
printf("Thread (%d) created successfully.\n", ids.tid);
// l4_thread_switch(0);
/* Kill it */
printf("Killing Thread (%d).\n", ids.tid);
if ((ret = l4_thread_control(THREAD_DESTROY, &ids)) < 0)
printf("Error: Killing Thread (%d), err = %d\n", ids.tid, ret);
else
printf("Success: Killed Thread (%d)\n", ids.tid);
#if 0 #if 0
/* Wait on it */ /* Performance tests */
printf("Waiting on Thread (%d) to exit.\n", ids.tid); if (test_performance() < 0)
if ((ret = l4_thread_control(THREAD_WAIT, &ids)) >= 0) printf("Performance tests failed.\n");
printf("Success. Paged child returned %d\n", ret);
else
printf("Error. Wait on (%d) failed. err = %d\n",
ids.tid, ret);
#endif #endif
return 0; if (test_smp() < 0)
out_err: printf("SMP tests failed.\n");
BUG();
/* API Tests */
if (test_api() < 0)
printf("API tests failed.\n");
/* Container client/server setup test */
if (test_cli_serv() < 0)
printf("Client/server tests failed.\n");
/* Container multithreaded/standalone setup test */
if (test_mthread() < 0)
printf("Multi-threaded tests failed.\n");
/* Parent quits */
printf("Test parent thread exiting...\n");
thread_exit(0);
} }
int main(void) int main(void)
@@ -66,15 +45,7 @@ int main(void)
printf("%s: Container %s started\n", printf("%s: Container %s started\n",
__CONTAINER__, __CONTAINER_NAME__); __CONTAINER__, __CONTAINER_NAME__);
capability_test(); run_tests();
//exit_test();
/* Now quit to demo self-paging quit */
//l4_exit(0);
/* Now quit by null pointer */
// *((int *)0) = 5;
return 0; return 0;
} }

View File

@@ -27,8 +27,8 @@ int test_api_map(void)
* Make a valid mapping, a few pages below * Make a valid mapping, a few pages below
* the end of physical and virtual marks * the end of physical and virtual marks
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
MAP_USR_RW, MAP_USR_RW,
self)) < 0) { self)) < 0) {
@@ -40,8 +40,8 @@ int test_api_map(void)
/* /*
* Redo the same mapping. This should be valid. * Redo the same mapping. This should be valid.
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
MAP_USR_RW, MAP_USR_RW,
self)) < 0) { self)) < 0) {
@@ -53,8 +53,8 @@ int test_api_map(void)
/* /*
* Try mapping outside the virtual range * Try mapping outside the virtual range
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END, (void *)CONFIG_CONT0_PAGER_VIRT0_END,
1, 1,
MAP_USR_RW, MAP_USR_RW,
self)) == 0) { self)) == 0) {
@@ -66,8 +66,8 @@ int test_api_map(void)
/* /*
* Try mapping outside the physical range * Try mapping outside the physical range
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
MAP_USR_RW, MAP_USR_RW,
self)) == 0) { self)) == 0) {
@@ -79,8 +79,8 @@ int test_api_map(void)
/* /*
* Try having them both out of range * Try having them both out of range
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END,
(void *)CONFIG_CONT0_VIRT0_END, (void *)CONFIG_CONT0_PAGER_VIRT0_END,
1, 1,
MAP_USR_RW, MAP_USR_RW,
self)) == 0) { self)) == 0) {
@@ -93,8 +93,8 @@ int test_api_map(void)
/* /*
* Try out of range by off-by-one page size excess * Try out of range by off-by-one page size excess
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
6, 6,
MAP_USR_RW, MAP_USR_RW,
self)) == 0) { self)) == 0) {
@@ -108,8 +108,8 @@ int test_api_map(void)
/* /*
* Try invalid page size * Try invalid page size
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
0xFFFFFFFF, 0xFFFFFFFF,
MAP_USR_RW, MAP_USR_RW,
self)) == 0) { self)) == 0) {
@@ -122,8 +122,8 @@ int test_api_map(void)
* Try invalid flags * Try invalid flags
*/ */
flags = 0; flags = 0;
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
flags, flags,
self)) == 0) { self)) == 0) {
@@ -132,8 +132,8 @@ int test_api_map(void)
return -1; return -1;
} }
flags = MAP_KERN_RWX; flags = MAP_KERN_RWX;
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
0, 0,
self)) == 0) { self)) == 0) {
@@ -142,8 +142,8 @@ int test_api_map(void)
return -1; return -1;
} }
flags = MAP_KERN_IO; flags = MAP_KERN_IO;
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
0, 0,
self)) == 0) { self)) == 0) {
@@ -153,8 +153,8 @@ int test_api_map(void)
} }
flags = MAP_KERN_RX; flags = MAP_KERN_RX;
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
0, 0,
self)) == 0) { self)) == 0) {
@@ -164,8 +164,8 @@ int test_api_map(void)
} }
flags = 0xF0F0F01; flags = 0xF0F0F01;
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
0, 0,
self)) == 0) { self)) == 0) {
@@ -178,7 +178,7 @@ int test_api_map(void)
* Try passing wraparound values * Try passing wraparound values
*/ */
if ((err = l4_map((void *)0xFFFFFFFF, if ((err = l4_map((void *)0xFFFFFFFF,
(void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, (void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
MAP_USR_RW, MAP_USR_RW,
self)) == 0) { self)) == 0) {
@@ -190,7 +190,7 @@ int test_api_map(void)
/* /*
* Try passing wraparound values * Try passing wraparound values
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)0xFFFFF000, (void *)0xFFFFF000,
2, 2,
MAP_USR_RW, MAP_USR_RW,
@@ -203,7 +203,7 @@ int test_api_map(void)
/* /*
* Try mapping onto kernel * Try mapping onto kernel
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)0xF0000000, (void *)0xF0000000,
1, 1,
MAP_USR_RW, MAP_USR_RW,
@@ -216,7 +216,7 @@ int test_api_map(void)
/* /*
* Try mapping to vector page * Try mapping to vector page
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)0xFFFF0000, (void *)0xFFFF0000,
1, 1,
MAP_USR_RW, MAP_USR_RW,
@@ -229,7 +229,7 @@ int test_api_map(void)
/* /*
* Try mapping to kip * Try mapping to kip
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)0xFF000000, (void *)0xFF000000,
1, 1,
MAP_USR_RW, MAP_USR_RW,
@@ -242,7 +242,7 @@ int test_api_map(void)
/* /*
* Try mapping to syscall page * Try mapping to syscall page
*/ */
if ((err = l4_map((void *)CONFIG_CONT0_PHYS0_END - PAGE_SIZE * 5, if ((err = l4_map((void *)CONFIG_CONT0_PAGER_PHYS0_END - PAGE_SIZE * 5,
(void *)0xFFFFF000, (void *)0xFFFFF000,
1, 1,
MAP_USR_RW, MAP_USR_RW,
@@ -264,7 +264,7 @@ int test_api_unmap(void)
/* /*
* Try a valid unmap * Try a valid unmap
*/ */
if ((err = l4_unmap((void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, if ((err = l4_unmap((void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
self)) < 0) { self)) < 0) {
dbg_printf("sys_unmap failed on valid request. err=%d\n", dbg_printf("sys_unmap failed on valid request. err=%d\n",
@@ -275,7 +275,7 @@ int test_api_unmap(void)
/* /*
* Try the same unmap, should return ENOMAP * Try the same unmap, should return ENOMAP
*/ */
if ((err = l4_unmap((void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, if ((err = l4_unmap((void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 1,
self)) != -ENOMAP) { self)) != -ENOMAP) {
dbg_printf("sys_unmap did not return ENOMAP " dbg_printf("sys_unmap did not return ENOMAP "
@@ -314,7 +314,7 @@ int test_api_unmap(void)
"unmap region. err=%d\n", err); "unmap region. err=%d\n", err);
return -1; return -1;
} }
if ((err = l4_unmap((void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, if ((err = l4_unmap((void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
0xFFFFFFFF, self)) == 0) { 0xFFFFFFFF, self)) == 0) {
dbg_printf("sys_unmap succeeded on invalid " dbg_printf("sys_unmap succeeded on invalid "
"unmap region. err=%d\n", err); "unmap region. err=%d\n", err);
@@ -324,7 +324,7 @@ int test_api_unmap(void)
/* /*
* Try unmapping zero pages * Try unmapping zero pages
*/ */
if ((err = l4_unmap((void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, if ((err = l4_unmap((void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
0, self)) == 0) { 0, self)) == 0) {
dbg_printf("sys_unmap succeeded on invalid " dbg_printf("sys_unmap succeeded on invalid "
"unmap region. err=%d\n", err); "unmap region. err=%d\n", err);
@@ -334,7 +334,7 @@ int test_api_unmap(void)
/* /*
* Try unmapping with invalid id * Try unmapping with invalid id
*/ */
if ((err = l4_unmap((void *)CONFIG_CONT0_VIRT0_END - PAGE_SIZE * 5, if ((err = l4_unmap((void *)CONFIG_CONT0_PAGER_VIRT0_END - PAGE_SIZE * 5,
1, 0xFFFFFFFF)) == 0) { 1, 0xFFFFFFFF)) == 0) {
dbg_printf("sys_unmap succeeded on invalid " dbg_printf("sys_unmap succeeded on invalid "
"unmap region. err=%d\n", err); "unmap region. err=%d\n", err);

View File

@@ -0,0 +1,198 @@
/*
* Empty virtual and physical pages for
* creating test scenarios
*
* Copyright (C) 2010 B Labs Ltd.
*
* Author: Bahadir Balban
*/
#include <l4lib/lib/addr.h>
#include INC_GLUE(memory.h)
#include <l4/generic/cap-types.h>
#include <l4lib/lib/cap.h>
#include <l4/lib/math.h>
#include <stdio.h>
#include <memory.h>
#include <linker.h>
#include <tests.h>
/*
* Declare a statically allocated char buffer
* with enough bitmap size to cover given size
*/
#define DECLARE_IDPOOL(name, size) \
char name[(sizeof(struct id_pool) + ((size >> 12) >> 3))]
struct address_pool virtual_page_pool, physical_page_pool;
#define PAGE_POOL_SIZE SZ_16MB
DECLARE_IDPOOL(virtual_idpool, PAGE_POOL_SIZE);
DECLARE_IDPOOL(physical_idpool, PAGE_POOL_SIZE);
#define virt_to_phys(virtual) ((unsigned long)(virtual) - (unsigned long)(offset))
#define phys_to_virt(physical) ((unsigned long)(physical) + (unsigned long)(offset))
#define TEST_POOL_TOTAL 5
/*
* Test page pool
*/
void test_page_pool(void)
{
void *p[TEST_POOL_TOTAL], *v[TEST_POOL_TOTAL];
/* Allocate test pages */
for (int i = 0; i < TEST_POOL_TOTAL; i++) {
v[i] = virtual_page_new(1);
p[i] = physical_page_new(1);
dbg_printf("Test allocated: Virtual%d: 0x%p, "
"Physical%d, 0x%p\n",
i, v[i], i, p[i]);
}
/* Free test pages */
for (int i = 0; i < TEST_POOL_TOTAL; i++) {
virtual_page_free(v[i], 1);
physical_page_free(p[i], 1);
}
/* Re-allocate test pages */
for (int i = 0; i < TEST_POOL_TOTAL; i++) {
v[i] = virtual_page_new(1);
p[i] = physical_page_new(1);
dbg_printf("Test allocated: Virtual%d: 0x%p, "
"Physical%d, 0x%p\n",
i, v[i], i, p[i]);
}
/* Free test pages */
for (int i = 0; i < TEST_POOL_TOTAL; i++) {
virtual_page_free(v[i], 1);
physical_page_free(p[i], 1);
}
/* Allocate in different lengths */
for (int i = 0; i < TEST_POOL_TOTAL; i++) {
v[i] = virtual_page_new(i);
p[i] = physical_page_new(i);
dbg_printf("Test allocated: Virtual%d: 0x%p, "
"Physical%d, 0x%p\n",
i, v[i], i, p[i]);
}
/* Free test pages in different order */
for (int i = TEST_POOL_TOTAL - 1; i >= 0; i--) {
virtual_page_free(v[i], 1);
physical_page_free(p[i], 1);
}
/* Allocate in different lengths */
for (int i = 0; i < TEST_POOL_TOTAL; i++) {
v[i] = virtual_page_new(i);
p[i] = physical_page_new(i);
dbg_printf("Test allocated: Virtual%d: 0x%p, "
"Physical%d, 0x%p\n",
i, v[i], i, p[i]);
}
/* Free test pages in normal order */
for (int i = 0; i < TEST_POOL_TOTAL; i++) {
virtual_page_free(v[i], 1);
physical_page_free(p[i], 1);
}
}
void page_pool_init(void)
{
struct capability *physcap, *virtcap;
unsigned long phys_start, phys_end;
unsigned long virt_start, virt_end;
/*
* Get physmem capability (Must be only one)
*/
if (!(physcap = cap_get_physmem(CAP_TYPE_MAP_PHYSMEM))) {
printf("FATAL: Could not find a physical memory"
"capability to use as a page pool.\n");
BUG();
}
/*
* Get virtmem capability (Must be only one)
*/
if (!(virtcap = cap_get_by_type(CAP_TYPE_MAP_VIRTMEM))) {
printf("FATAL: Could not find a virtual memory"
"capability to use as a page pool.\n");
BUG();
}
/*
* Now initialize physical and virtual page marks
* from unused pages. Linker script will help us
* on this.
*/
/*
printf("__data_start symbol: %lx\n", (unsigned long)__data_start);
printf("__data_end symbol: %lx\n", (unsigned long)__data_end);
printf("__bss_start symbol: %lx\n", (unsigned long)__bss_start);
printf("__bss_end symbol: %lx\n", (unsigned long)__bss_end);
printf("__stack_start symbol: %lx\n", (unsigned long)__stack_start);
printf("__stack_end symbol: %lx\n", (unsigned long)__stack_end);
printf("__end symbol: %lx\n", (unsigned long)__end);
*/
phys_start = page_align_up(virt_to_phys(__end) +
(unsigned long)lma_start);
phys_end = __pfn_to_addr(physcap->end);
dbg_printf("%s: Initializing physical range 0x%lx - 0x%lx\n",
__FUNCTION__, phys_start, phys_end);
virt_start = page_align_up(__end) + (unsigned long)lma_start;
virt_end = __pfn_to_addr(virtcap->end);
dbg_printf("%s: Initializing virtual range 0x%lx - 0x%lx\n",
__FUNCTION__, virt_start, virt_end);
/* Initialize pools, maximum of PAGE_POOL_SIZE size */
address_pool_init(&virtual_page_pool,
(struct id_pool *)&virtual_idpool,
virt_start, min(virt_end,
virt_start + PAGE_POOL_SIZE));
address_pool_init(&physical_page_pool,
(struct id_pool *)&physical_idpool,
phys_start, min(phys_end,
phys_start + PAGE_POOL_SIZE));
// test_page_pool();
}
/*
* Some tests require page-faulting virtual addresses or
* differing virtual addresses that map onto the same
* physical page. These functions provide these pages.
*/
void *virtual_page_new(int npages)
{
return address_new(&virtual_page_pool, npages, PAGE_SIZE);
}
void *physical_page_new(int npages)
{
return address_new(&physical_page_pool, npages, PAGE_SIZE);
}
void virtual_page_free(void *address, int npages)
{
address_del(&virtual_page_pool, address,
npages, PAGE_SIZE);
}
void physical_page_free(void *address, int npages)
{
address_del(&physical_page_pool, address,
npages, PAGE_SIZE);
}

View File

@@ -0,0 +1,204 @@
/*
* Test l4_mutex_control system call.
*
* Copyright (C) 2010 B Labs Ltd.
*
* Author: Bahadir Balban
*/
#include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syslib.h)
#include L4LIB_INC_ARCH(syscalls.h)
#include <l4lib/lib/thread.h>
#include <l4lib/mutex.h>
#include <tests.h>
#define MUTEX_NTHREADS 8
#define MUTEX_INCREMENTS 200
#define MUTEX_VALUE_TOTAL (MUTEX_NTHREADS * MUTEX_INCREMENTS)
struct mutex_test_data {
struct l4_mutex lock;
int val;
};
static struct mutex_test_data tdata;
static void init_test_data(struct mutex_test_data *tdata)
{
l4_mutex_init(&tdata->lock);
tdata->val = 0;
}
int mutex_thread_non_contending(void *arg)
{
struct mutex_test_data *data =
(struct mutex_test_data *)arg;
l4id_t tid = self_tid();
int err = tid;
for (int i = 0; i < MUTEX_INCREMENTS; i++) {
/* Lock the data structure */
if ((err = l4_mutex_lock(&data->lock)) < 0) {
dbg_printf("Thread %d: Acquiring mutex failed. "
"err = %d\n", tid, err);
return -err;
}
/*
* Increment and release lock
*/
data->val++;
/* Unlock the data structure */
if ((err = l4_mutex_unlock(&data->lock)) < 0) {
dbg_printf("Thread %d: Releasing the mutex failed. "
"err = %d\n", tid, err);
return -err;
}
}
return 0;
}
int mutex_thread_contending(void *arg)
{
struct mutex_test_data *data =
(struct mutex_test_data *)arg;
l4id_t tid = self_tid();
int err = tid;
for (int i = 0; i < MUTEX_INCREMENTS; i++) {
/* Lock the data structure */
if ((err = l4_mutex_lock(&data->lock)) < 0) {
dbg_printf("Thread %d: Acquiring mutex failed. "
"err = %d\n", tid, err);
return -err;
}
/*
* Sleep some time to have some
* threads blocked on the mutex
*/
for (int j = 0; j < 3; j++)
l4_thread_switch(0);
/*
* Increment and release lock
*/
data->val++;
/* Unlock the data structure */
if ((err = l4_mutex_unlock(&data->lock)) < 0) {
dbg_printf("Thread %d: Releasing the mutex failed. "
"err = %d\n", tid, err);
return -err;
}
}
return 0;
}
int test_mutex(int (*mutex_thread)(void *))
{
struct l4_thread *thread[MUTEX_NTHREADS];
int err;
/* Init mutex data */
init_test_data(&tdata);
/*
* Lock the mutex so nobody starts working
*/
if ((err = l4_mutex_lock(&tdata.lock)) < 0) {
dbg_printf("Acquiring mutex failed. "
"err = %d\n", err);
return err;
}
/* Create threads */
for (int i = 0; i < MUTEX_NTHREADS; i++) {
if ((err = thread_create(mutex_thread,
&tdata,
TC_SHARE_SPACE,
&thread[i])) < 0) {
dbg_printf("Thread create failed. "
"err=%d\n", err);
return err;
}
}
/* Unlock the mutex and initiate all workers */
if ((err = l4_mutex_unlock(&tdata.lock)) < 0) {
dbg_printf("Releasing the mutex failed. "
"err = %d\n", err);
return -err;
}
/*
* Wait for all threads to exit successfully
*/
for (int i = 0; i < MUTEX_NTHREADS; i++) {
if ((err = thread_wait(thread[i])) < 0) {
dbg_printf("THREAD_WAIT failed. "
"err=%d\n", err);
return err;
}
}
/*
* Test that lock is in correct state
*/
if (tdata.lock.lock != L4_MUTEX_UNLOCKED) {
dbg_printf("MUTEX is not in unlocked condition "
"after tests. lockval = %d, expected = %d\n",
tdata.lock.lock, L4_MUTEX_UNLOCKED);
return -1;
}
/*
* Test that increments have occured correctly
*/
if (tdata.val != MUTEX_VALUE_TOTAL) {
dbg_printf("Lock-protected value incremented incorrectly "
"after mutex worker threads.\n"
"val = %d, expected = %d\n",
tdata.val,
MUTEX_VALUE_TOTAL);
return -1;
}
if (tdata.val != MUTEX_VALUE_TOTAL) {
dbg_printf("Lock-protected value incremented incorrectly "
"after mutex worker threads.\n"
"val = %d, expected = %d\n",
tdata.val,
MUTEX_VALUE_TOTAL);
return -1;
}
dbg_printf("Mutex test successful.\n");
return 0;
}
int test_api_mutexctrl(void)
{
int err;
if ((err = test_mutex(mutex_thread_contending)) < 0)
goto out_err;
if ((err = test_mutex(mutex_thread_non_contending)) < 0)
goto out_err;
printf("USERSPACE MUTEX: -- PASSED --\n");
return 0;
out_err:
printf("USERSPACE MUTEX: -- FAILED --\n");
return err;
}

View File

@@ -1 +0,0 @@
arch-arm

View File

@@ -3,10 +3,11 @@
* *
* Copyright (C) 2008 - 2010 B Labs Ltd. * Copyright (C) 2008 - 2010 B Labs Ltd.
*/ */
#include <task.h> #include <macros.h>
#include <vm_area.h>
#include <l4lib/exregs.h> #include <l4lib/exregs.h>
#include __INC_ARCH(mm.h) #include <fault.h>
#include INC_SUBARCH(mm.h)
#include INC_SUBARCH(exception.h)
/* Extracts generic protection flags from architecture-specific pte */ /* Extracts generic protection flags from architecture-specific pte */
unsigned int vm_prot_flags(pte_t pte) unsigned int vm_prot_flags(pte_t pte)
@@ -60,6 +61,6 @@ void set_generic_fault_params(struct fault_data *fault)
else else
BUG(); BUG();
} }
arch_print_fault_params(fault); // arch_print_fault_params(fault);
} }

View File

@@ -4,13 +4,13 @@
* Copyright (C) 2009 B Labs Ltd. * Copyright (C) 2009 B Labs Ltd.
*/ */
#include <stdio.h> #include <stdio.h>
#include <l4lib/capability/cap_print.h> #include <l4lib/lib/cap.h>
#include <l4lib/macros.h> #include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syscalls.h) #include L4LIB_INC_ARCH(syscalls.h)
#if 0
static struct capability cap_array[30]; static struct capability cap_array[30];
#if 0
struct cap_group { struct cap_group {
struct cap_list virtmem; struct cap_list virtmem;
struct cap_list physmem; struct cap_list physmem;
@@ -75,7 +75,6 @@ void cap_grant_single(struct capability *orig, struct capability *share, l4id_t
{ {
} }
#endif
int caps_read_all(void) int caps_read_all(void)
{ {
@@ -104,3 +103,4 @@ int caps_read_all(void)
return 0; return 0;
} }
#endif

View File

@@ -19,8 +19,7 @@ int simple_pager_thread(void *arg)
printf("Thread spawned from pager, \ printf("Thread spawned from pager, \
trying to create new thread.\n"); trying to create new thread.\n");
err = l4_thread_control(THREAD_CREATE | err = l4_thread_control(THREAD_CREATE |
TC_SHARE_SPACE | TC_SHARE_SPACE, &ids);
TC_AS_PAGER, &ids);
if (res == 0) if (res == 0)
if (err == -ENOCAP || if (err == -ENOCAP ||

View File

@@ -39,7 +39,6 @@ void perf_measure_getid_ticks(void)
timer_load(timer_ldval, timer_base); timer_load(timer_ldval, timer_base);
/* Start the timer */ /* Start the timer */
printf("Starting the l4_getid timer tick test.\n");
timer_start(timer_base); timer_start(timer_base);
/* Do the operation */ /* Do the operation */
@@ -56,7 +55,7 @@ void perf_measure_getid_ticks(void)
total += last; total += last;
} }
printf("TIMER: l4_getid took each %u min, %u max, %u avg,\n" printf("L4_GETID(timer) took each %u min, %u max, %u avg, "
"%u total microseconds, and %u total ops\n", min, "%u total microseconds, and %u total ops\n", min,
max, total/ops, total, ops); max, total/ops, total, ops);
} }
@@ -77,7 +76,6 @@ void perf_measure_getid(void)
/* /*
* Do the test * Do the test
*/ */
printf("Starting the l4_getid cycle counter test.\n");
for (int i = 0; i < PERFTEST_GETID_COUNT; i++) { for (int i = 0; i < PERFTEST_GETID_COUNT; i++) {
perfmon_reset_start_cyccnt(); perfmon_reset_start_cyccnt();
l4_getid(&ids); l4_getid(&ids);
@@ -93,9 +91,9 @@ void perf_measure_getid(void)
/* /*
* Print results * Print results
*/ */
printf("PERFMON: %s took %llu min, %llu max, %llu avg, " printf("L4_GETID (cycle counter): took %llu cycles, %llu min, %llu max, %llu avg, "
"%llu total microseconds in %llu ops.\n", "%llu total microseconds in %llu ops.\n",
"l4_getid()", l4_getid_cycles.min,
l4_getid_cycles.min * USEC_MULTIPLIER, l4_getid_cycles.min * USEC_MULTIPLIER,
l4_getid_cycles.max * USEC_MULTIPLIER, l4_getid_cycles.max * USEC_MULTIPLIER,
l4_getid_cycles.avg * USEC_MULTIPLIER, l4_getid_cycles.avg * USEC_MULTIPLIER,

View File

@@ -8,4 +8,5 @@
void perf_measure_mutex(void) void perf_measure_mutex(void)
{ {
} }

View File

@@ -20,6 +20,7 @@ int test_performance(void)
perf_measure_getid_ticks(); perf_measure_getid_ticks();
perf_measure_getid(); perf_measure_getid();
perf_measure_tswitch();
perf_measure_tctrl(); perf_measure_tctrl();
perf_measure_exregs(); perf_measure_exregs();
perf_measure_ipc(); perf_measure_ipc();

View File

@@ -51,8 +51,9 @@ void perf_measure_tctrl(void)
/* /*
* Print results * Print results
*/ */
printf("%s took %llu min, %llu max, %llu avg, in %llu ops.\n", printf("%s took %llu cycles, %llu min, %llu max, %llu avg, in %llu ops.\n",
"THREAD_CREATE", "THREAD_CREATE",
tctrl_cycles.min,
tctrl_cycles.min * USEC_MULTIPLIER, tctrl_cycles.min * USEC_MULTIPLIER,
tctrl_cycles.max * USEC_MULTIPLIER, tctrl_cycles.max * USEC_MULTIPLIER,
tctrl_cycles.avg * USEC_MULTIPLIER, tctrl_cycles.avg * USEC_MULTIPLIER,

View File

@@ -11,7 +11,6 @@
#include L4LIB_INC_ARCH(syslib.h) #include L4LIB_INC_ARCH(syslib.h)
#include L4LIB_INC_ARCH(syscalls.h) #include L4LIB_INC_ARCH(syscalls.h)
/* Note this must be obtained from the capability */
#define TIMER_PHYSICAL_BASE 0x10012000 #define TIMER_PHYSICAL_BASE 0x10012000
unsigned long timer_base; unsigned long timer_base;

View File

@@ -0,0 +1,150 @@
/*
* Copyright (C) 2010 B Labs Ltd.
*
* l4_thread_control performance tests
*
* Author: Bahadir Balban
*/
#include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syslib.h)
#include L4LIB_INC_ARCH(syscalls.h)
#include <l4lib/lib/thread.h>
#include <l4lib/perfmon.h>
#include <perf.h>
#include <tests.h>
#include <string.h>
struct perfmon_cycles thread_switch_cycles;
struct perfmon_cycles space_switch_cycles;
static int indicate_switch = 0;
void thread_switcher_thread(void *arg)
{
l4id_t parent = ((struct task_ids *)arg)->tid;
printf("%s: Running\n", __FUNCTION__);
/* Wait until parent signals us to switch */
while (!indicate_switch)
l4_thread_switch(parent);
/*
* Now do one last switch, which will
* be used in the actual switch measurement
*/
l4_thread_switch(parent);
}
void perf_measure_thread_switch_simple(void)
{
struct task_ids thread_switcher;
struct task_ids selfid;
l4_getid(&selfid);
/*
* Initialize structures
*/
memset(&thread_switch_cycles, 0, sizeof (struct perfmon_cycles));
thread_switch_cycles.min = ~0; /* Init as maximum possible */
/* Start the counter */
perfmon_reset_start_cyccnt();
l4_thread_switch(0);
perfmon_record_cycles(&thread_switch_cycles, "THREAD_SWITCH");
/*
* Calculate average
*/
thread_switch_cycles.avg =
thread_switch_cycles.total / thread_switch_cycles.ops;
/*
* Print results
*/
printf("%s took %llu cycles, %llu min, %llu max, %llu avg, in %llu ops.\n",
"THREAD_SWITCH",
thread_switch_cycles.min,
thread_switch_cycles.min * USEC_MULTIPLIER,
thread_switch_cycles.max * USEC_MULTIPLIER,
thread_switch_cycles.avg * USEC_MULTIPLIER,
thread_switch_cycles.ops);
}
void perf_measure_thread_switch(void)
{
struct task_ids thread_switcher;
struct task_ids selfid;
l4_getid(&selfid);
/*
* Initialize structures
*/
memset(&thread_switch_cycles, 0, sizeof (struct perfmon_cycles));
thread_switch_cycles.min = ~0; /* Init as maximum possible */
/* Create switcher thread */
l4_thread_control(THREAD_CREATE | TC_SHARE_SPACE, &selfid);
/* Copy ids of created task */
memcpy(&thread_switcher, &selfid, sizeof(struct task_ids));
/* Switch to the thread to ensure it runs at least once */
l4_thread_switch(thread_switcher.tid);
/* Start the counter */
perfmon_reset_start_cyccnt();
/* Set the switch indicator */
indicate_switch = 1;
/*
* Switch to thread.
*
* We should be in full control here, because
* the thread must have run out of its time slices.
*/
l4_thread_switch(thread_switcher.tid);
/*
* By this time, the switcher thread must have done a
* thread switch back to us
*/
perfmon_record_cycles(&thread_switch_cycles, "THREAD_SWITCH");
/*
* Calculate average
*/
thread_switch_cycles.avg =
thread_switch_cycles.total / thread_switch_cycles.ops;
/*
* Print results
*/
printf("%s took %llu cycles, %llu min, %llu max, %llu avg, in %llu ops.\n",
"THREAD_SWITCH",
thread_switch_cycles.min,
thread_switch_cycles.min * USEC_MULTIPLIER,
thread_switch_cycles.max * USEC_MULTIPLIER,
thread_switch_cycles.avg * USEC_MULTIPLIER,
thread_switch_cycles.ops);
/* Destroy the thread */
l4_thread_control(THREAD_DESTROY, &thread_switcher);
}
void perf_measure_space_switch(void)
{
}
void perf_measure_tswitch(void)
{
perf_measure_thread_switch_simple();
perf_measure_space_switch();
}

View File

@@ -0,0 +1,11 @@
# Inherit global environment
Import('env')
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -4,62 +4,54 @@
# #
# Copyright © 2009 B Labs Ltd # Copyright © 2009 B Labs Ltd
# #
import os, shelve, sys import os, sys
from os.path import * from os.path import *
PROJRELROOT = '../..' CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
sys.path.append(PROJRELROOT) from scripts.config.projpaths import *
from scripts.conts.containers import *
from config.projpaths import * from scripts.config.configuration import *
from config.configuration import *
config = configuration_retrieve() config = configuration_retrieve()
platform = config.platform
arch = config.arch
gcc_arch_flag = config.gcc_arch_flag gcc_arch_flag = config.gcc_arch_flag
LIBL4_RELDIR = 'conts/libl4' cid = int(ARGUMENTS.get('cid', 0))
KERNEL_INCLUDE = join(PROJROOT, 'include') cont = find_container_from_cid(cid)
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
# Locally important paths are here builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
LIBC_RELDIR = 'conts/libc'
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
join(LIBC_DIR, 'include/arch' + '/' + arch)]
LIBDEV_RELDIR = 'conts/libdev' # linker.lds is generated either in conts/xxx or build/contx/include
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) if cont.duplicate == 0:
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') linker_lds = join(builddir, 'include/linker.lds')
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')] else:
linker_lds = 'include/linker.lds'
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
LIBMEM_INCLUDE = LIBMEM_DIR
env = Environment(CC = config.toolchain_userspace + 'gcc', env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk(). # such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \ CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag], '-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"], LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'], ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['libl4', 'libmalloc', 'c-userspace', 'libdev-userspace', \ LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace',
'gcc', 'c-userspace'], # libgcc.a - This is required for division routines. 'libmem', 'gcc', 'c-userspace'],
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE], # libgcc.a - This is required for division routines.
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH], CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h \
-include l4/types.h -include l4lib/macros.h')
src = Glob('*.[cS]') objs = SConscript('SConscript', exports = { 'env' : env },
src += Glob('src/*.[cS]') duplicate=0, build_dir = builddir)
objs = env.Object(src) Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program('main.elf', objs)
Depends(prog, 'include/linker.lds') prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, linker_lds)

View File

@@ -0,0 +1,108 @@
/*
* Test l4_mutex_control system call.
*
* Copyright (C) 2010 B Labs Ltd.
*
* Author: Bahadir Balban
*/
#include <l4lib/macros.h>
#include L4LIB_INC_ARCH(syslib.h)
#include L4LIB_INC_ARCH(syscalls.h)
#include <l4lib/lib/thread.h>
#define NTHREADS 6
#define dbg_printf printf
int thread_test_func1(void *arg)
{
l4id_t tid = self_tid();
printf("tid = %d is called.\n", tid);
/* Wait for a while before exiting */
int j = 0x400000;
while (j--)
;
return tid;
}
int thread_test_func2(void *arg)
{
l4id_t tid = self_tid();
printf("tid = %d is called.\n", tid);
/* Wait for a while before exiting */
int j = 0x400000;
while (j--)
;
thread_exit(0);
return 0;
}
int thread_demo()
{
struct l4_thread *thread[NTHREADS];
int err;
/* Create threads */
for (int i = 0; i < NTHREADS; i++) {
if (i % 2 ) {
err = thread_create(thread_test_func1, 0,
TC_SHARE_SPACE, &thread[i]);
if (err < 0) {
dbg_printf("Thread create failed. "
"err=%d i= %d\n", err, i);
return err;
}
} else {
err = thread_create(thread_test_func2, 0,
TC_SHARE_SPACE, &thread[i]);
if (err < 0) {
dbg_printf("Thread create failed. "
"err=%d i= %d\n", err, i);
return err;
}
}
}
/*
* Wait for all threads to exit successfully
*/
for (int i = 0; i < NTHREADS; i++) {
if ((err = thread_wait(thread[i])) < 0) {
dbg_printf("THREAD_WAIT failed. "
"err=%d\n", err);
return err;
}
}
dbg_printf("Thread test successful.\n");
return 0;
}
int main(void)
{
int err;
__l4_threadlib_init();
if ((err = thread_demo()) < 0)
goto out_err;
printf("THREAD DEMO: -- PASSED --\n");
return 0;
out_err:
printf("THREAD DEMO: -- FAILED --\n");
return err;
}

View File

@@ -0,0 +1,12 @@
# Inherit global environment
Import('env')
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
src_local += Glob('src/arch/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -7,64 +7,51 @@
import os, shelve, sys import os, shelve, sys
from os.path import * from os.path import *
PROJRELROOT = '../..' CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
sys.path.append(PROJRELROOT) from scripts.config.projpaths import *
from scripts.config.configuration import *
from config.projpaths import * from scripts.conts.containers import *
from config.configuration import * from scripts.config.config_invoke import *
from configure import *
config = configuration_retrieve() config = configuration_retrieve()
arch = config.arch
platform = config.platform
gcc_arch_flag = config.gcc_arch_flag gcc_arch_flag = config.gcc_arch_flag
# Wrapper library for system calls cid = int(ARGUMENTS.get('cid', 0))
LIBL4_RELDIR = 'conts/libl4' cont = find_container_from_cid(cid)
KERNEL_INCLUDE = join(PROJROOT, 'include')
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
# Some user-space libraries builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
LIBC_RELDIR = 'conts/libc'
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
join(LIBC_DIR, 'include/arch' + '/' + arch)]
LIBDEV_RELDIR = 'conts/libdev' # linker.lds is generated either in conts/xxx or build/contx/include
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) if cont.duplicate == 0:
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') linker_lds = join(builddir, 'include/linker.lds')
LIBDEV_INCLUDE = join(LIBDEV_DIR, 'include') else:
linker_lds = 'include/linker.lds'
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
LIBMEM_INCLUDE = LIBMEM_DIR
env = Environment(CC = config.toolchain_userspace + 'gcc', env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk(). # such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \ CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag], \ '-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"],\ LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'], \ ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', \ LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace',
'libmm', 'libmc', 'libmalloc', 'gcc', 'c-userspace'], 'libmem', 'gcc', 'c-userspace'],
# libgcc.a - This is required for division routines. # libgcc.a - This is required for division routines.
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, \ CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
LIBC_INCLUDE, LIBMEM_INCLUDE], LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH], LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
src = Glob('*.[cS]') objs = SConscript('SConscript', exports = { 'env' : env },
src += Glob('src/*.[cS]') duplicate=0, build_dir = builddir)
src += Glob('src/arch/*.[cS]')
objs = env.Object(src) Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program('main.elf', objs)
Depends(prog, 'include/linker.lds') prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, linker_lds)

View File

@@ -7,6 +7,7 @@
#include <l4lib/init.h> #include <l4lib/init.h>
#include <l4lib/utcb.h> #include <l4lib/utcb.h>
#include <l4lib/lib/thread.h> #include <l4lib/lib/thread.h>
#include <l4lib/lib/cap.h>
void main(void); void main(void);
@@ -18,6 +19,8 @@ void __container_init(void)
/* Thread library initialisation */ /* Thread library initialisation */
__l4_threadlib_init(); __l4_threadlib_init();
__l4_capability_init();
/* Entry to main */ /* Entry to main */
main(); main();
} }

View File

@@ -78,7 +78,8 @@ struct timer {
unsigned int count; /* Counter/jiffies */ unsigned int count; /* Counter/jiffies */
struct sleeper_task_bucket task_list; /* List of sleeping tasks */ struct sleeper_task_bucket task_list; /* List of sleeping tasks */
struct l4_mutex task_list_lock; /* Lock for sleeper_task_bucket */ struct l4_mutex task_list_lock; /* Lock for sleeper_task_bucket */
struct capability cap; /* Capability describing timer */ unsigned long phys_base; /* Physical address of Device */
int irq_no; /* IRQ number of device */
}; };
#endif /* __TIMER_H__ */ #endif /* __TIMER_H__ */

View File

@@ -2,6 +2,7 @@
* Timer service for userspace * Timer service for userspace
*/ */
#include <l4lib/lib/addr.h> #include <l4lib/lib/addr.h>
#include <l4lib/lib/cap.h>
#include <l4lib/irq.h> #include <l4lib/irq.h>
#include <l4lib/lib/thread.h> #include <l4lib/lib/thread.h>
#include <l4lib/ipcdefs.h> #include <l4lib/ipcdefs.h>
@@ -10,14 +11,15 @@
#include <l4/api/capability.h> #include <l4/api/capability.h>
#include <l4/generic/cap-types.h> #include <l4/generic/cap-types.h>
#include <l4/api/space.h> #include <l4/api/space.h>
#include <malloc/malloc.h> #include <mem/malloc.h>
#include <container.h> #include <container.h>
#include <linker.h> #include <linker.h>
#include <timer.h> #include <timer.h>
#include <libdev/timer.h> #include <dev/timer.h>
#include <dev/platform.h>
/* Capabilities of this service */ /* Capabilities of this service */
static struct capability caparray[32]; static struct capability *caparray;
static int total_caps = 0; static int total_caps = 0;
/* Total number of timer chips being handled by us */ /* Total number of timer chips being handled by us */
@@ -33,33 +35,6 @@ struct wake_task_list wake_tasks;
/* tid of handle_request thread */ /* tid of handle_request thread */
l4id_t tid_ipc_handler; l4id_t tid_ipc_handler;
int cap_read_all()
{
int ncaps;
int err;
/* Read number of capabilities */
if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
0, &ncaps)) < 0) {
printf("l4_capability_control() reading # of"
" capabilities failed.\n Could not "
"complete CAP_CONTROL_NCAPS request.\n");
BUG();
}
total_caps = ncaps;
/* Read all capabilities */
if ((err = l4_capability_control(CAP_CONTROL_READ,
0, caparray)) < 0) {
printf("l4_capability_control() reading of "
"capabilities failed.\n Could not "
"complete CAP_CONTROL_READ_CAPS request.\n");
BUG();
}
return 0;
}
int cap_share_all_with_space() int cap_share_all_with_space()
{ {
int err; int err;
@@ -160,32 +135,6 @@ struct link* find_bucket_list(unsigned long seconds)
return vector; return vector;
} }
/*
* Scans for up to TIMERS_TOTAL timer devices in capabilities.
*/
int timer_probe_devices(void)
{
int timers = 0;
/* Scan for timer devices */
for (int i = 0; i < total_caps; i++) {
/* Match device type */
if (cap_devtype(&caparray[i]) == CAP_DEVTYPE_TIMER) {
/* Copy to correct device index */
memcpy(&global_timer[cap_devnum(&caparray[i]) - 1].cap,
&caparray[i], sizeof(global_timer[0].cap));
timers++;
}
}
if (timers != TIMERS_TOTAL) {
printf("%s: Error, not all timers could be found. "
"timers=%d\n", __CONTAINER_NAME__, timers);
return -ENODEV;
}
return 0;
}
/* /*
* Irq handler for timer interrupts * Irq handler for timer interrupts
*/ */
@@ -204,7 +153,7 @@ int timer_irq_handler(void *arg)
/* Register self for timer irq, using notify slot 0 */ /* Register self for timer irq, using notify slot 0 */
if ((err = l4_irq_control(IRQ_CONTROL_REGISTER, slot, if ((err = l4_irq_control(IRQ_CONTROL_REGISTER, slot,
timer->cap.irq)) < 0) { timer->irq_no)) < 0) {
printf("%s: FATAL: Timer irq could not be registered. " printf("%s: FATAL: Timer irq could not be registered. "
"err=%d\n", __FUNCTION__, err); "err=%d\n", __FUNCTION__, err);
BUG(); BUG();
@@ -219,7 +168,7 @@ int timer_irq_handler(void *arg)
struct link *task_list; struct link *task_list;
/* Block on irq */ /* Block on irq */
if((count = l4_irq_wait(slot, timer->cap.irq)) < 0) { if((count = l4_irq_wait(slot, timer->irq_no)) < 0) {
printf("l4_irq_wait() returned with negative value\n"); printf("l4_irq_wait() returned with negative value\n");
BUG(); BUG();
} }
@@ -234,6 +183,7 @@ int timer_irq_handler(void *arg)
/* find bucket list of taks to be woken for current count */ /* find bucket list of taks to be woken for current count */
vector = find_bucket_list(timer->count); vector = find_bucket_list(timer->count);
l4_send(tid_ipc_handler,L4_IPC_TAG_TIMER_WAKE_THREADS);
if (!list_empty(vector)) { if (!list_empty(vector)) {
/* Removing tasks from sleeper list */ /* Removing tasks from sleeper list */
@@ -300,19 +250,21 @@ int timer_setup_devices(void)
struct l4_thread *tptr = &thread; struct l4_thread *tptr = &thread;
int err; int err;
global_timer[0].phys_base = PLATFORM_TIMER1_BASE;
global_timer[0].irq_no = IRQ_TIMER1;
for (int i = 0; i < TIMERS_TOTAL; i++) { for (int i = 0; i < TIMERS_TOTAL; i++) {
/* initialize timer */ /* initialize timer */
timer_struct_init(&global_timer[i],(unsigned long)l4_new_virtual(1) ); timer_struct_init(&global_timer[i],(unsigned long)l4_new_virtual(1) );
/* Map timer to a virtual address region */ /* Map timer to a virtual address region */
if (IS_ERR(l4_map((void *)__pfn_to_addr(global_timer[i].cap.start), if (IS_ERR(l4_map((void *)global_timer[i].phys_base,
(void *)global_timer[i].base, global_timer[i].cap.size, (void *)global_timer[i].base, 1,
MAP_USR_IO, MAP_USR_IO, self_tid()))) {
self_tid()))) { printf("%s: FATAL: Failed to map TIMER device from 0x%lx"
printf("%s: FATAL: Failed to map TIMER device " " to 0x%lx\n", __CONTAINER_NAME__,
"%d to a virtual address\n", global_timer[i].phys_base,
__CONTAINER_NAME__, global_timer[i].base);
cap_devnum(&global_timer[i].cap));
BUG(); BUG();
} }
@@ -502,64 +454,20 @@ void handle_requests(void)
} }
} }
/*
* UTCB-size aligned utcb.
*
* BIG WARNING NOTE: This declaration is legal if we are
* running in a disjoint virtual address space, where the
* utcb declaration lies in a unique virtual address in
* the system.
*/
#define DECLARE_UTCB(name) \
struct utcb name ALIGN(sizeof(struct utcb))
DECLARE_UTCB(utcb);
/* Set up own utcb for ipc */
int l4_utcb_setup(void *utcb_address)
{
struct task_ids ids;
struct exregs_data exregs;
int err;
l4_getid(&ids);
/* Clear utcb */
memset(utcb_address, 0, sizeof(struct utcb));
/* Setup exregs for utcb request */
memset(&exregs, 0, sizeof(exregs));
exregs_set_utcb(&exregs, (unsigned long)utcb_address);
if ((err = l4_exchange_registers(&exregs, ids.tid)) < 0)
return err;
return 0;
}
void main(void) void main(void)
{ {
int err;
/* Read all capabilities */ /* Read all capabilities */
cap_read_all(); caps_read_all();
total_caps = cap_get_count();
caparray = cap_get_all();
/* Share all with space */ /* Share all with space */
cap_share_all_with_space(); cap_share_all_with_space();
/* Scan for timer devices in capabilities */
timer_probe_devices();
/* Initialize virtual address pool for timers */ /* Initialize virtual address pool for timers */
init_vaddr_pool(); init_vaddr_pool();
/* Setup own static utcb */
if ((err = l4_utcb_setup(&utcb)) < 0) {
printf("FATAL: Could not set up own utcb. "
"err=%d\n", err);
BUG();
}
/* initialise timed_out_task list */ /* initialise timed_out_task list */
wake_task_list_init(); wake_task_list_init();

View File

@@ -0,0 +1,11 @@
# Inherit global environment
Import('env')
# The set of source files associated with this SConscript file.
src_local = Glob('*.[cS]')
src_local += Glob('src/*.[cS]')
obj = env.Object(src_local)
Return('obj')

View File

@@ -7,60 +7,50 @@
import os, shelve, sys import os, shelve, sys
from os.path import * from os.path import *
PROJRELROOT = '../..' CONTS_XXX = '../..'
BAREMETAL_CONTS_XXX = '../../..'
sys.path.append(CONTS_XXX)
sys.path.append(BAREMETAL_CONTS_XXX)
sys.path.append(PROJRELROOT) from scripts.config.projpaths import *
from scripts.conts.containers import *
from config.projpaths import * from scripts.config.configuration import *
from config.configuration import *
config = configuration_retrieve() config = configuration_retrieve()
platform = config.platform
arch = config.arch
gcc_arch_flag = config.gcc_arch_flag gcc_arch_flag = config.gcc_arch_flag
LIBL4_RELDIR = 'conts/libl4' cid = int(ARGUMENTS.get('cid', 0))
KERNEL_INCLUDE = join(PROJROOT, 'include') cont = find_container_from_cid(cid)
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
# Locally important paths are here builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
LIBC_RELDIR = 'conts/libc'
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
join(LIBC_DIR, 'include/arch' + '/' + arch)]
LIBDEV_RELDIR = 'conts/libdev' # linker.lds is generated either in conts/xxx or build/contx/include
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) if cont.duplicate == 0:
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') linker_lds = join(builddir, 'include/linker.lds')
LIBDEV_INCLUDE = join(LIBDEV_DIR, 'include') else:
linker_lds = 'include/linker.lds'
# FIXME: Add these to autogenerated SConstruct !!!
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
LIBMEM_INCLUDE = LIBMEM_DIR
env = Environment(CC = config.toolchain_userspace + 'gcc', env = Environment(CC = config.toolchain_userspace + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk(). # such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \ CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall',
'-Werror', '-march=' + gcc_arch_flag], '-Werror', '-march=' + gcc_arch_flag],
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"], LINKFLAGS = ['-nostdlib', '-T' + linker_lds, '-u_start'],
ASFLAGS = ['-D__ASSEMBLY__'], \ ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable\ PROGSUFFIX = '.elf',
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path\ ENV = {'PATH' : os.environ['PATH']},
LIBS = ['gcc', 'libl4', 'libmalloc', 'c-userspace', 'libdev-userspace', LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace',
'gcc', 'c-userspace'], # libgcc.a - This is required for division routines. 'libmem', 'gcc', 'c-userspace'],
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE, LIBMEM_INCLUDE], # libgcc.a - This is required for division routines.
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH], CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
src = Glob('*.[cS]') objs = SConscript('SConscript', exports = { 'env' : env },
src += Glob('src/*.[cS]') duplicate=0, build_dir = builddir)
objs = env.Object(src) Depends(objs, join(PROJROOT, CONFIG_H))
prog = env.Program('main.elf', objs)
Depends(prog, 'include/linker.lds') prog = env.Program(join(builddir, 'main.elf'), objs)
Depends(prog, linker_lds)

View File

@@ -6,7 +6,8 @@
#include <l4lib/init.h> #include <l4lib/init.h>
#include <l4lib/utcb.h> #include <l4lib/utcb.h>
#include <l4lib/lib/thread.h>
#include <l4lib/lib/cap.h>
extern void main(void); extern void main(void);
@@ -15,6 +16,11 @@ void __container_init(void)
/* Generic L4 initialisation */ /* Generic L4 initialisation */
__l4_init(); __l4_init();
/* Thread library initialisation */
__l4_threadlib_init();
__l4_capability_init();
/* Entry to main */ /* Entry to main */
main(); main();
} }

Some files were not shown because too many files have changed in this diff Show More