Changed the virt-to-phys debug breakpoint name to break_virtual

Changed l4id_t type to integer to recognise negative id values like L4_ANYTHREAD.
Added an extremely simple script that cleans and builds everything in right order.

Increased boot pmds by one:
This is due to the fact that if the 1MB initial allocation area of the kernel is
not 1MB-aligned, it is ought to be mapped from the middle of one MB to next,
which requires 2 pmds.

	modified:   .gdbinit
	modified:   README
	new file:   buildall.sh
	modified:   include/l4/arch/arm/types.h
	modified:   include/l4/generic/scheduler.h
	modified:   loader/kernel.S
	modified:   loader/main.c
	modified:   loader/mylink.lds
	modified:   loader/start.axf.S
	modified:   src/glue/arm/init.c
	modified:   src/glue/arm/memory.c
	modified:   tasks/fs0/src/bdev.c
	modified:   tasks/mm0/include/kdata.h
	modified:   tasks/mm0/include/vm_area.h
	modified:   tasks/mm0/src/init.c
	modified:   tasks/mm0/src/task.c
	modified:   tools/ksym_to_lds.py
	modified:   tools/l4-qemu
This commit is contained in:
Bahadir Balban
2008-02-04 16:44:11 +00:00
parent cab2e8bdd3
commit 938672f7c9
18 changed files with 114 additions and 80 deletions

View File

@@ -6,7 +6,7 @@
extern char _start_bdev[];
extern char _end_bdev[];
__attribute__((section(".data.memfs"))) char blockdevice[SZ_16MB];
__attribute__((section(".data.memfs"))) char blockdevice[SZ_1MB*2];
void *vfs_rootdev_open(void)
{

View File

@@ -20,7 +20,7 @@
struct initdata {
struct bootdesc *bootdesc;
struct vm_file *memfile;
struct list_head boot_file_list;
struct page_bitmap page_map;
};

View File

@@ -83,7 +83,7 @@ struct inode {
struct vm_file {
struct inode inode;
unsigned long length;
struct list_head list; /* List of all vm files in memory */
/* This is the cache of physical pages that this file has in memory. */
struct list_head page_cache_list;
struct vm_pager *pager;

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2007 Bahadir Balban
*/
#include <stdio.h>
#include <string.h>
#include <kdata.h>
#include <memory.h>
#include <mm/alloc_page.h>
@@ -52,27 +53,28 @@ void init_mm(struct initdata *initdata)
/* Create temporary run-time files in memory to test with mmap */
void init_boot_files(struct initdata *initdata)
{
struct bootdesc *bd = initdata->bootdesc;
int total_files = bd->total_images;
struct vm_file *memfile;
struct vm_file *f;
struct svc_image *img;
struct bootdesc *bd = initdata->bootdesc;
memfile = kzalloc(sizeof(struct vm_file) * total_files);
initdata->memfile = memfile;
BUG();
for (int i = BOOTDESC_IMAGE_START; i < total_files; i++) {
INIT_LIST_HEAD(&initdata->boot_file_list);
for (int i = BOOTDESC_IMAGE_START; i < bd->total_images; i++) {
img = &bd->images[i];
if (!(!strcmp(img->name, "fs0") || !strcmp(img->name, "test0")))
continue; /* Img is not what we want */
f = kzalloc(sizeof(*f));
INIT_LIST_HEAD(&f->list);
INIT_LIST_HEAD(&f->page_cache_list);
list_add(&f->list, &initdata->boot_file_list);
/*
* I have left the i_addr as physical on purpose. The inode is
* not a readily usable memory address, its simply a unique key
* that represents that file. Here, we use the physical address
* of the memory file as that key. The pager must take action in
* order to make use of it.
* For boot files, we use the physical address of the memory
* file as its inode.
*/
memfile[i].inode.i_addr = img->phys_start;
memfile[i].length = img->phys_end - img->phys_start;
memfile[i].pager = &default_file_pager;
INIT_LIST_HEAD(&memfile[i].page_cache_list);
f->inode.i_addr = img->phys_start;
f->length = img->phys_end - img->phys_start;
f->pager = &default_file_pager;
}
}

View File

@@ -52,38 +52,34 @@ void dump_tasks(void)
#endif
void create_init_tcbs(struct initdata *initdata)
struct tcb *create_init_tcb(struct tcb_head *tcbs)
{
struct bootdesc *bd = initdata->bootdesc;
INIT_LIST_HEAD(&tcb_head.list);
tcb_head.total++;
struct tcb *task = kzalloc(sizeof(struct tcb));
for (int i = BOOTDESC_IMAGE_START; i < bd->total_images; i++) {
struct tcb *task = kzalloc(sizeof(struct tcb));
/* Ids will be acquired from the kernel */
task->tid = TASK_ID_INVALID;
task->spid = TASK_ID_INVALID;
task->swap_file = kzalloc(sizeof(struct vm_file));
task->swap_file->pager = &swap_pager;
vaddr_pool_init(task->swap_file_offset_pool, 0,
__pfn(TASK_SWAPFILE_MAXSIZE));
INIT_LIST_HEAD(&task->swap_file->page_cache_list);
INIT_LIST_HEAD(&task->list);
INIT_LIST_HEAD(&task->vm_area_list);
list_add_tail(&task->list, &tcbs->list);
tcbs->total++;
/* Ids will be acquired from the kernel */
task->tid = TASK_ID_INVALID;
task->spid = TASK_ID_INVALID;
task->swap_file = kzalloc(sizeof(struct vm_file));
task->swap_file->pager = &swap_pager;
vaddr_pool_init(task->swap_file_offset_pool, 0,
__pfn(TASK_SWAPFILE_MAXSIZE));
INIT_LIST_HEAD(&task->swap_file->page_cache_list);
INIT_LIST_HEAD(&task->list);
INIT_LIST_HEAD(&task->vm_area_list);
list_add_tail(&task->list, &tcb_head.list);
}
return task;
}
int start_init_tasks(struct initdata *initdata)
int start_boot_tasks(struct initdata *initdata, struct tcb_head *tcbs)
{
struct tcb *task;
struct vm_file *file;
int err;
int i = BOOTDESC_IMAGE_START;
list_for_each_entry(task, &tcb_head.list, list) {
struct vm_file *file = &initdata->memfile[i++];
INIT_LIST_HEAD(&tcb_head.list);
list_for_each_entry(file, &initdata->boot_file_list, list) {
struct tcb *task = create_init_tcb(tcbs);
unsigned int sp = align(USER_AREA_END - 1, 8);
unsigned int pc = USER_AREA_START;
struct task_ids ids = { .tid = task->tid, .spid = task->spid };
@@ -132,7 +128,7 @@ int start_init_tasks(struct initdata *initdata)
/* Start the thread */
if ((err = l4_thread_control(THREAD_RUN, &ids) < 0)) {
printf("l4_thread_control failed with %d\n");
printf("l4_thread_control failed with %d\n", err);
goto error;
}
}
@@ -144,10 +140,14 @@ error:
void init_pm(struct initdata *initdata)
{
create_init_tcbs(initdata);
start_init_tasks(initdata);
start_boot_tasks(initdata, &tcb_head);
}
/*
* During its initialisation FS0 wants to learn how many boot tasks
* are running, and their tids, which includes itself. This function
* provides that information.
*/
void send_task_data(l4id_t requester)
{
struct tcb *t;