Merge branch 'master' into linux

This commit is contained in:
Bahadir Balban
2009-10-15 20:11:46 +03:00
13 changed files with 223 additions and 61 deletions

View File

@@ -304,6 +304,13 @@ CONT%(cn)d_VIRT5_END 'Container %(cn)d Virtual Region 5 End Address'
CONT%(cn)d_PAGER_LMA 'Container %(cn)d Pager LMA' CONT%(cn)d_PAGER_LMA 'Container %(cn)d Pager LMA'
CONT%(cn)d_PAGER_VMA 'Container %(cn)d Pager VMA' CONT%(cn)d_PAGER_VMA 'Container %(cn)d Pager VMA'
CONT%(cn)d_PAGER_SIZE 'Container %(cn)d Pager Initial Map Size (Optional)' CONT%(cn)d_PAGER_SIZE 'Container %(cn)d Pager Initial Map Size (Optional)'
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_PAGE_OFFSET 'Container %(cn)d Linux PAGE_OFFSET 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_PHYS_OFFSET 'Container %(cn)d Linux PHYS_OFFSET Parameter'
CONT%(cn)d_LINUX_MAPSIZE 'Container %(cn)d Linux Initial Kernel Map Size Parameter' CONT%(cn)d_LINUX_MAPSIZE 'Container %(cn)d Linux Initial Kernel Map Size Parameter'
@@ -311,6 +318,13 @@ CONT%(cn)d_LINUX_MAPSIZE 'Container %(cn)d Linux Initial Kernel Map Size Paramet
default CONT%(cn)d_PAGER_LMA from 0x0 default CONT%(cn)d_PAGER_LMA from 0x0
default CONT%(cn)d_PAGER_VMA from 0x0 default CONT%(cn)d_PAGER_VMA from 0x0
default CONT%(cn)d_PAGER_SIZE from 0x0 default CONT%(cn)d_PAGER_SIZE from 0x0
default CONT%(cn)d_PAGER_SHM_START from 0x0
default CONT%(cn)d_PAGER_SHM_END from 0x0
default CONT%(cn)d_PAGER_TASK_START from 0x0
default CONT%(cn)d_PAGER_TASK_END from 0x0
default CONT%(cn)d_PAGER_UTCB_START from 0x0
default CONT%(cn)d_PAGER_UTCB_END from 0x0
default CONT%(cn)d_LINUX_PAGE_OFFSET from 0x0 default CONT%(cn)d_LINUX_PAGE_OFFSET from 0x0
default CONT%(cn)d_LINUX_PHYS_OFFSET from 0x0 default CONT%(cn)d_LINUX_PHYS_OFFSET from 0x0
default CONT%(cn)d_LINUX_MAPSIZE from 0x0 default CONT%(cn)d_LINUX_MAPSIZE from 0x0
@@ -370,8 +384,8 @@ default CONT%(cn)d_VIRT5_END from 0x0
default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_BARE==y) ? "bare%(cn)d" : "posix%(cn)d") default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_BARE==y) ? "bare%(cn)d" : "posix%(cn)d")
when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_bare_pager_params when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_bare_pager_params cont%(cn)d_posix_pager_params
when CONT%(cn)d_TYPE_BARE==y suppress cont%(cn)d_linux_pager_params when CONT%(cn)d_TYPE_BARE==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params
when CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_linux_pager_params when CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_linux_pager_params
symbols symbols
@@ -381,14 +395,24 @@ cont%(cn)d_virtmem_list 'Container %(cn)d Virtual Memory Regions'
container%(cn)d_type 'Container %(cn)d Type' container%(cn)d_type 'Container %(cn)d Type'
container%(cn)d_options 'Container %(cn)d Options' container%(cn)d_options 'Container %(cn)d Options'
cont%(cn)d_linux_pager_params 'Container %(cn)d Pager Parameters' cont%(cn)d_linux_pager_params 'Container %(cn)d Linux Pager Parameters'
cont%(cn)d_bare_pager_params 'Container %(cn)d Pager Parameters' cont%(cn)d_bare_pager_params 'Container %(cn)d Default Pager Parameters'
cont%(cn)d_posix_pager_params 'Container %(cn)d POSIX Pager Parameters'
menu cont%(cn)d_bare_pager_params menu cont%(cn)d_bare_pager_params
CONT%(cn)d_PAGER_LMA@ CONT%(cn)d_PAGER_LMA@
CONT%(cn)d_PAGER_VMA@ CONT%(cn)d_PAGER_VMA@
CONT%(cn)d_PAGER_SIZE@ CONT%(cn)d_PAGER_SIZE@
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 menu cont%(cn)d_linux_pager_params
CONT%(cn)d_LINUX_PAGE_OFFSET@ CONT%(cn)d_LINUX_PAGE_OFFSET@
CONT%(cn)d_LINUX_PHYS_OFFSET@ CONT%(cn)d_LINUX_PHYS_OFFSET@
@@ -414,6 +438,7 @@ menu container%(cn)d_options
CONT%(cn)d_OPT_NAME$ CONT%(cn)d_OPT_NAME$
cont%(cn)d_linux_pager_params cont%(cn)d_linux_pager_params
cont%(cn)d_bare_pager_params cont%(cn)d_bare_pager_params
cont%(cn)d_posix_pager_params
cont%(cn)d_physmem_list cont%(cn)d_physmem_list
cont%(cn)d_virtmem_list cont%(cn)d_virtmem_list

View File

@@ -13,6 +13,12 @@ class Container:
self.pager_lma = 0 self.pager_lma = 0
self.pager_vma = 0 self.pager_vma = 0
self.pager_size = 0 self.pager_size = 0
self.pager_task_region_start = 0
self.pager_task_region_end = 0
self.pager_shm_region_start = 0
self.pager_shm_region_end = 0
self.pager_utcb_region_start = 0
self.pager_utcb_region_end = 0
self.linux_page_offset = 0 self.linux_page_offset = 0
self.linux_phys_offset = 0 self.linux_phys_offset = 0
self.linux_mapsize = 0 self.linux_mapsize = 0
@@ -31,6 +37,12 @@ class Container:
print 'Container Name: %s' % self.name print 'Container Name: %s' % self.name
print 'Container Pager lma: %s' % conv_hex(self.pager_lma) print 'Container Pager lma: %s' % conv_hex(self.pager_lma)
print 'Container Pager vma: %s' % conv_hex(self.pager_vma) print 'Container Pager vma: %s' % conv_hex(self.pager_vma)
print 'Container Pager shm region start: %s' % conv_hex(self.pager_shm_region_start)
print 'Container Pager shm region end: %s' % conv_hex(self.pager_shm_region_end)
print 'Container Pager task region start: %s' % conv_hex(self.pager_task_region_start)
print 'Container Pager task region end: %s' % conv_hex(self.pager_task_region_end)
print 'Container Pager utcb region start: %s' % conv_hex(self.pager_utcb_region_start)
print 'Container Pager utcb region end: %s' % conv_hex(self.pager_utcb_region_end)
print 'Container Pager size: %s' % conv_hex(self.pager_size) print 'Container Pager size: %s' % conv_hex(self.pager_size)
print 'Container Virtual regions: %s' % self.virt_regions print 'Container Virtual regions: %s' % self.virt_regions
print 'Container Physical regions: %s' % self.phys_regions print 'Container Physical regions: %s' % self.phys_regions
@@ -86,6 +98,18 @@ class configuration:
self.containers[id].pager_lma = int(val, 0) self.containers[id].pager_lma = int(val, 0)
elif param[:len("PAGER_VMA")] == "PAGER_VMA": elif param[:len("PAGER_VMA")] == "PAGER_VMA":
self.containers[id].pager_vma = int(val, 0) self.containers[id].pager_vma = int(val, 0)
elif param[:len("PAGER_UTCB_START")] == "PAGER_UTCB_START":
self.containers[id].pager_utcb_region_start = int(val, 0)
elif param[:len("PAGER_UTCB_END")] == "PAGER_UTCB_END":
self.containers[id].pager_utcb_region_end = int(val, 0)
elif param[:len("PAGER_SHM_START")] == "PAGER_SHM_START":
self.containers[id].pager_shm_region_start = int(val, 0)
elif param[:len("PAGER_SHM_END")] == "PAGER_SHM_END":
self.containers[id].pager_shm_region_end = int(val, 0)
elif param[:len("PAGER_TASK_START")] == "PAGER_TASK_START":
self.containers[id].pager_task_region_start = int(val, 0)
elif param[:len("PAGER_TASK_END")] == "PAGER_TASK_END":
self.containers[id].pager_task_region_end = int(val, 0)
elif param[:len("PAGER_SIZE")] == "PAGER_SIZE": elif param[:len("PAGER_SIZE")] == "PAGER_SIZE":
self.containers[id].pager_size = int(val, 0) self.containers[id].pager_size = int(val, 0)
elif param[:len("LINUX_MAPSIZE")] == "LINUX_MAPSIZE": elif param[:len("LINUX_MAPSIZE")] == "LINUX_MAPSIZE":

View File

@@ -35,18 +35,27 @@ def build_parse_options():
default = False, dest = "backup_config", default = False, dest = "backup_config",
help = "Backs up old configuration file settings to a .saved file" help = "Backs up old configuration file settings to a .saved file"
"(Subsequent calls would overwrite. Only meaningful with -r)") "(Subsequent calls would overwrite. Only meaningful with -r)")
parser.add_option("-p", "--print-config", action = "store_true",
default = False, dest = "print_config",
help = "Prints out configuration settings"
"(Symbol values and container parameters are printed)")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
autogen_true = len(sys.argv) > 1 or not os.path.exists(CML2_CML_FILE) autogen_true = options.backup_config or options.reset_old_config \
or options.cml_file or options.config \
or options.ncont or options.arch or not os.path.exists(CML2_CML_FILE)
# Prepare default if arch not supplied
if autogen_true and not options.arch: if autogen_true and not options.arch:
print "No arch supplied (-a), using `arm' as default." print "No arch supplied (-a), using `arm' as default."
options.arch = "arm" options.arch = "arm"
# Prepare default if number of containers not supplied
if autogen_true and not options.ncont: if autogen_true and not options.ncont:
options.ncont = 4 options.ncont = 4
print "Max container count not supplied (-c), using %d as default." % options.ncont print "Max container count not supplied (-n), using %d as default." % options.ncont
# Regenerate cml file if options are supplied or the file doesn't exist. # Regenerate cml file if options are supplied or the file doesn't exist.
if autogen_true: if autogen_true:

View File

@@ -56,7 +56,6 @@ def configure_kernel(cml_file):
cml2_update_config_h(CONFIG_H, config) cml2_update_config_h(CONFIG_H, config)
configuration_save(config) configuration_save(config)
#config.config_print()
# Generate bare container files if new ones defined # Generate bare container files if new ones defined
bare_cont_gen = BareContGenerator() bare_cont_gen = BareContGenerator()
@@ -65,7 +64,11 @@ def configure_kernel(cml_file):
# Generate kernel cinfo structure for container definitions # Generate kernel cinfo structure for container definitions
generate_kernel_cinfo(config, KERNEL_CINFO_PATH) generate_kernel_cinfo(config, KERNEL_CINFO_PATH)
if __name__ == "__main__": return config
build_parse_options()
configure_kernel(join(CML2_CONFIG_SRCDIR, "out.cml")) if __name__ == "__main__":
opts, args = build_parse_options()
config = configure_kernel(join(CML2_CONFIG_SRCDIR, "out.cml"))
if opts.print_config:
config.config_print()

View File

@@ -20,24 +20,48 @@ def create_symlinks(arch):
os.system("rm %s" % (arch_path2)) os.system("rm %s" % (arch_path2))
os.system("ln -s %s %s" % ("arch-" + arch, arch_path2)) os.system("ln -s %s %s" % ("arch-" + arch, arch_path2))
def generate_lma_lds(target, source, env): def generate_container_h(target, source, env):
base_value_dict = {}
with open(source[0].path, 'r') as ch_in:
with open(target[0].path, 'w+') as ch_out:
container_h = ch_in.read()
assert container.pager_task_region_start != 0
assert container.pager_task_region_end != 0
assert container.pager_shm_region_start != 0
assert container.pager_shm_region_end != 0
assert container.pager_utcb_region_start != 0
assert container.pager_utcb_region_end != 0
base_value_dict = { 'task_start' : conv_hex(container.pager_task_region_start), \
'task_end' : conv_hex(container.pager_task_region_end), \
'shmem_start' : conv_hex(container.pager_shm_region_start), \
'shmem_end' : conv_hex(container.pager_shm_region_end), \
'utcb_start' : conv_hex(container.pager_utcb_region_start), \
'utcb_end' : conv_hex(container.pager_utcb_region_end) }
ch_out.write(container_h % base_value_dict)
def generate_vma_lma_lds(target, source, env):
with open(source[0].path, 'r') as lds_in: with open(source[0].path, 'r') as lds_in:
with open(target[0].path, 'w+') as lds_out: with open(target[0].path, 'w+') as lds_out:
linker_script = lds_in.read() linker_script = lds_in.read()
assert container.pager_lma != 0 assert container.pager_lma != 0
lds_out.write(linker_script % conv_hex(container.pager_lma)) assert container.pager_vma != 0
lds_out.write(linker_script % (conv_hex(container.pager_vma), \
conv_hex(container.pager_lma)))
lma_lds = Command('include/linker.lds', 'include/linker.lds.in', generate_lma_lds) lma_lds = Command('include/linker.lds', 'include/linker.lds.in', generate_vma_lma_lds)
container_h = Command('include/container.h', 'include/container.h.in', generate_container_h)
src = [Glob('*.c') + Glob('mm/*.c') + Glob('lib/*.c') + Glob('fs/*.c') + Glob('fs/memfs/*.c') + Glob('lib/elf/*.c') + Glob('mm/arch/*.c')] src = [Glob('*.c') + Glob('mm/*.c') + Glob('lib/*.c') + Glob('fs/*.c') + Glob('fs/memfs/*.c') + Glob('lib/elf/*.c') + Glob('mm/arch/*.c')]
e = env.Clone() e = env.Clone()
e.Append(LINKFLAGS = ['-T' + lma_lds[0].path, '-u_start']) e.Append(LINKFLAGS = ['-T' + lma_lds[0].path, '-u_start'])
e.Append(LIBS = 'posix') e.Append(LIBS = 'posix')
e.Append(CPPFLAGS = ' -include ' + container_h[0].path)
objs = e.Object(src) objs = e.Object(src)
mm0 = e.Program('mm0.elf', objs) mm0 = e.Program('mm0.elf', objs)
Depends(objs, container_h)
Depends(mm0, lma_lds) Depends(mm0, lma_lds)
Return('mm0') Return('mm0')

View File

@@ -0,0 +1,14 @@
#ifndef __MM0_CONTAINER_H__
#define __MM0_CONTAINER_H__
#define SHMEM_REGION_START %(shmem_start)s
#define SHMEM_REGION_END %(shmem_end)s
#define TASK_REGION_START %(task_start)s
#define TASK_REGION_END %(task_end)s
#define UTCB_REGION_START %(utcb_start)s
#define UTCB_REGION_END %(utcb_end)s
#endif /* __MM0_CONTAINER_H__ */

View File

@@ -18,8 +18,6 @@
#include <capability.h> #include <capability.h>
struct initdata { struct initdata {
struct capability *bootcaps;
struct capability *physmem;
struct bootdesc *bootdesc; struct bootdesc *bootdesc;
struct page_bitmap *page_map; struct page_bitmap *page_map;
unsigned long pager_utcb_virt; unsigned long pager_utcb_virt;

View File

@@ -4,7 +4,7 @@
/* /*
* Linker script-defined memory markers. * Linker script-defined memory markers.
*/ */
extern unsigned long virtual_base[];
extern unsigned long __start_text[]; extern unsigned long __start_text[];
extern unsigned long __end_text[]; extern unsigned long __end_text[];
extern unsigned long __start_data[]; extern unsigned long __start_data[];

View File

@@ -4,7 +4,7 @@
* Copyright (C) 2007 - 2009 Bahadir Balban * Copyright (C) 2007 - 2009 Bahadir Balban
*/ */
virtual_base = 0xE0000000; virtual_base = %s;
physical_base = %s; physical_base = %s;
pager_offset = virtual_base - physical_base; pager_offset = virtual_base - physical_base;

View File

@@ -228,7 +228,8 @@ int do_execve(struct tcb *sender, char *filename,
return 0; return 0;
} }
int sys_execve(struct tcb *sender, char *pathname, char *argv[], char *envp[]) int sys_execve(struct tcb *sender, char *pathname,
char *argv[], char *envp[])
{ {
int ret; int ret;
char *path; char *path;
@@ -242,17 +243,19 @@ int sys_execve(struct tcb *sender, char *pathname, char *argv[], char *envp[])
memset(&env, 0, sizeof(env)); memset(&env, 0, sizeof(env));
/* Copy the executable path string */ /* Copy the executable path string */
if ((ret = copy_user_string(sender, path, pathname, PATH_MAX)) < 0) if ((ret = copy_user_string(sender, path,
pathname, PATH_MAX)) < 0)
return ret; return ret;
// printf("%s: Copied pathname: %s\n", __FUNCTION__, path);
/* Copy the args */ /* Copy the args */
if (argv && ((ret = copy_user_args(sender, &args, argv, ARGS_MAX)) < 0)) if (argv && ((ret = copy_user_args(sender, &args,
argv, ARGS_MAX)) < 0))
goto out1; goto out1;
/* Copy the env */ /* Copy the env */
if (envp && ((ret = copy_user_args(sender, &env, envp, if (envp && ((ret = copy_user_args(sender, &env, envp,
ARGS_MAX - args.size)) < 0)) ARGS_MAX - args.size))
< 0))
goto out2; goto out2;
ret = do_execve(sender, path, &args, &env); ret = do_execve(sender, path, &args, &env);

View File

@@ -43,6 +43,13 @@ struct memdesc physmem; /* Initial, primitive memory descriptor */
struct membank membank[1]; /* The memory bank */ struct membank membank[1]; /* The memory bank */
struct page *page_array; /* The physical page array based on mem bank */ struct page *page_array; /* The physical page array based on mem bank */
struct container_memory_regions {
struct capability *shmem;
struct capability *utcb;
struct capability *task;
struct capability *pager;
struct capability *physmem;
} cont_mem_regions;
/* Capability descriptor list */ /* Capability descriptor list */
struct cap_list capability_list; struct cap_list capability_list;
@@ -50,7 +57,6 @@ struct cap_list capability_list;
__initdata static struct capability *caparray; __initdata static struct capability *caparray;
__initdata static int total_caps = 0; __initdata static int total_caps = 0;
void print_pfn_range(int pfn, int size) void print_pfn_range(int pfn, int size)
{ {
unsigned int addr = pfn << PAGE_BITS; unsigned int addr = pfn << PAGE_BITS;
@@ -153,10 +159,11 @@ int pager_setup_task(void)
} }
/* Copy all init-memory allocated capabilities */ /* Copy all init-memory allocated capabilities */
void copy_boot_capabilities() void copy_boot_capabilities(int ncaps)
{ {
struct capability *cap; struct capability *cap;
link_init(&capability_list.caps);
for (int i = 0; i < total_caps; i++) { for (int i = 0; i < total_caps; i++) {
cap = kzalloc(sizeof(struct capability)); cap = kzalloc(sizeof(struct capability));
@@ -167,14 +174,16 @@ void copy_boot_capabilities()
link_init(&cap->list); link_init(&cap->list);
/* Add capability to global cap list */ /* Add capability to global cap list */
list_insert(&capability_list.caps, &cap->list); list_insert(&cap->list, &capability_list.caps);
} }
capability_list.ncaps = ncaps;
} }
int read_pager_capabilities() int read_pager_capabilities()
{ {
int ncaps; int ncaps;
int err; int err;
struct capability *cap;
/* Read number of capabilities */ /* Read number of capabilities */
if ((err = l4_capability_control(CAP_CONTROL_NCAPS, if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
@@ -182,7 +191,9 @@ int read_pager_capabilities()
printf("l4_capability_control() reading # of" printf("l4_capability_control() reading # of"
" capabilities failed.\n Could not " " capabilities failed.\n Could not "
"complete CAP_CONTROL_NCAPS request.\n"); "complete CAP_CONTROL_NCAPS request.\n");
goto error; BUG();
} else {
printf("There are %d capabilities defined.\n", ncaps);
} }
total_caps = ncaps; total_caps = ncaps;
@@ -195,33 +206,88 @@ int read_pager_capabilities()
printf("l4_capability_control() reading of " printf("l4_capability_control() reading of "
"capabilities failed.\n Could not " "capabilities failed.\n Could not "
"complete CAP_CONTROL_READ_CAPS request.\n"); "complete CAP_CONTROL_READ_CAPS request.\n");
goto error; BUG();
} }
/* Set up initdata pointer to important capabilities */ /* Copy them to real allocated structures */
initdata.bootcaps = caparray; copy_boot_capabilities(ncaps);
for (int i = 0; i < ncaps; i++) {
/* memset(&cont_mem_regions, 0, sizeof(cont_mem_regions));
* TODO: There may be multiple physmem caps!
* This really needs to be considered as multiple /* Set up pointers to important capabilities */
* membanks!!! list_foreach_struct(cap, &capability_list.caps, list) {
*/ /* Physical memory bank */
if ((caparray[i].type & CAP_RTYPE_MASK) if ((cap->type & CAP_RTYPE_MASK)
== CAP_RTYPE_PHYSMEM) { == CAP_RTYPE_PHYSMEM)
initdata.physmem = &caparray[i]; cont_mem_regions.physmem = cap;
return 0;
/* Virtual regions */
if ((cap->type & CAP_RTYPE_MASK)
== CAP_RTYPE_VIRTMEM) {
printf("Capability range 0x%lx - 0x%lx\n",
__pfn_to_addr(cap->start), __pfn_to_addr(cap->end));
/* Pager address region (get from linker-defined) */
if (__pfn_to_addr(cap->start)
== (unsigned long)virtual_base)
cont_mem_regions.pager = cap;
/* UTCB address region */
else if (UTCB_REGION_START == __pfn_to_addr(cap->start)) {
if (UTCB_REGION_END != __pfn_to_addr(cap->end)) {
printf("FATAL: Region designated "
"for UTCB allocation does not "
"match on start/end marks");
BUG();
}
if (!(cap->access & CAP_MAP_UTCB_BIT)) {
printf("FATAL: Region designated "
"for UTCB allocation does not "
"have UTCB map permissions");
BUG();
}
cont_mem_regions.utcb = cap;
}
/* Shared memory disjoint region */
else if (SHMEM_REGION_START == __pfn_to_addr(cap->start)) {
if (SHMEM_REGION_END != __pfn_to_addr(cap->end)) {
printf("FATAL: Region designated "
"for SHM allocation does not "
"match on start/end marks");
BUG();
}
cont_mem_regions.shmem = cap;
}
/* Task memory region */
else if (TASK_REGION_START == __pfn_to_addr(cap->start)) {
if (TASK_REGION_END != __pfn_to_addr(cap->end)) {
printf("FATAL: Region designated "
"for Task address space does not "
"match on start/end marks");
BUG();
}
cont_mem_regions.task = cap;
}
} }
} }
printf("%s: Error, pager has no physmem " if (!cont_mem_regions.task ||
"capability defined.\n", __TASKNAME__); !cont_mem_regions.shmem ||
!cont_mem_regions.utcb ||
goto error; !cont_mem_regions.physmem ||
!cont_mem_regions.pager) {
printf("%s: Error, pager does not have one of the required"
"mem capabilities defined. (TASK, SHM, PHYSMEM, UTCB)\n",
__TASKNAME__);
printf("%p, %p, %p, %p, %p\n", cont_mem_regions.task, cont_mem_regions.shmem, cont_mem_regions.utcb, cont_mem_regions.physmem, cont_mem_regions.pager);
BUG();
}
return 0; return 0;
error:
BUG();
} }
/* /*
@@ -230,12 +296,6 @@ error:
*/ */
void release_initdata() void release_initdata()
{ {
/*
* Copy boot capabilities to a list of
* real capabilities
*/
copy_boot_capabilities();
/* Free and unmap init memory: /* Free and unmap init memory:
* *
* FIXME: We can and do safely unmap the boot * FIXME: We can and do safely unmap the boot
@@ -397,14 +457,14 @@ void init_physmem_primary()
/* Allocate page map structure */ /* Allocate page map structure */
initdata.page_map = initdata.page_map =
alloc_bootmem(sizeof(struct page_bitmap) + alloc_bootmem(sizeof(struct page_bitmap) +
((initdata.physmem->end - ((cont_mem_regions.physmem->end -
initdata.physmem->start) cont_mem_regions.physmem->start)
>> 5) + 1, 0); >> 5) + 1, 0);
/* Initialise page map from physmem capability */ /* Initialise page map from physmem capability */
init_page_map(initdata.page_map, init_page_map(initdata.page_map,
initdata.physmem->start, cont_mem_regions.physmem->start,
initdata.physmem->end); cont_mem_regions.physmem->end);
/* Mark pager and other boot task areas as used */ /* Mark pager and other boot task areas as used */
for (int i = 0; i < bootdesc->total_images; i++) { for (int i = 0; i < bootdesc->total_images; i++) {
@@ -419,8 +479,8 @@ void init_physmem_primary()
pfn_end - pfn_start, 1); pfn_end - pfn_start, 1);
} }
physmem.start = initdata.physmem->start; physmem.start = cont_mem_regions.physmem->start;
physmem.end = initdata.physmem->end; physmem.end = cont_mem_regions.physmem->end;
physmem.free_cur = pfn_images_end; physmem.free_cur = pfn_images_end;
physmem.free_end = physmem.end; physmem.free_end = physmem.end;

View File

@@ -11,6 +11,8 @@ from tools.pyelf.lmanext import *
src = [Glob('*.c') + Glob('test_exec.S') + Glob('src/*.[Sc]') + Glob('src/arch/arm/*.c')] src = [Glob('*.c') + Glob('test_exec.S') + Glob('src/*.[Sc]') + Glob('src/arch/arm/*.c')]
container = next((c for c in config.containers if int(c.id) == int(contid)), None)
asm_string = \ asm_string = \
''' '''
.align 4 .align 4
@@ -26,7 +28,7 @@ def generate_lma_lds(target, source, env):
with open(source[1].path, 'r') as lds_in: with open(source[1].path, 'r') as lds_in:
with open(target[0].path, 'w+') as lds_out: with open(target[0].path, 'w+') as lds_out:
linker_script = lds_in.read() linker_script = lds_in.read()
lds_out.write(linker_script % next_available_lma(source[0].path)) lds_out.write(linker_script % (container.pager_task_region_start, next_available_lma(source[0].path)))
lma_lds = Command('include/linker.lds', [previmage, 'include/linker.lds.in'], generate_lma_lds) lma_lds = Command('include/linker.lds', [previmage, 'include/linker.lds.in'], generate_lma_lds)

View File

@@ -4,7 +4,7 @@
* Copyright (C) 2007 - 2009 Bahadir Balban * Copyright (C) 2007 - 2009 Bahadir Balban
*/ */
virtual_base = 0x10000000; virtual_base = %s;
physical_base = %s; physical_base = %s;
__stack = (0x20000000 - 0x1000 - 8); /* First page before the env/args */ __stack = (0x20000000 - 0x1000 - 8); /* First page before the env/args */