mirror of
https://github.com/drasko/codezero.git
synced 2026-04-18 01:39:05 +02:00
test and thread_demo container compiling, but crashing at runtime
This commit is contained in:
@@ -39,6 +39,11 @@ LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace')
|
|||||||
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')]
|
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')]
|
||||||
LIBDEV_CCFLAGS = '-DPLATFORM_' + platform.upper()
|
LIBDEV_CCFLAGS = '-DPLATFORM_' + platform.upper()
|
||||||
|
|
||||||
|
LIBMEM_RELDIR = 'conts/libmem'
|
||||||
|
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||||
|
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||||
|
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||||
|
|
||||||
env = Environment(CC = config.user_toolchain + 'gcc',
|
env = Environment(CC = config.user_toolchain + '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().
|
||||||
@@ -48,9 +53,10 @@ env = Environment(CC = config.user_toolchain + 'gcc',
|
|||||||
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', 'c-userspace'], # libgcc.a - This is required for division routines.
|
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', 'gcc', 'libmalloc',
|
||||||
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE],
|
'c-userspace'], # libgcc.a - This is required for division routines.
|
||||||
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH],
|
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE, LIBMEM_INCLUDE],
|
||||||
|
LIBPATH = [LIBL4_LIBPATH, LIBDEV_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]')
|
src = Glob('*.[cS]')
|
||||||
|
|||||||
6
conts/baremetal/test/include/capability.h
Normal file
6
conts/baremetal/test/include/capability.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef __CAPABILITY_H__
|
||||||
|
#define __CAPABILITY_H__
|
||||||
|
|
||||||
|
int caps_read_all();
|
||||||
|
|
||||||
|
#endif /* __CAPABILITY_H__ */
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
#include <l4/api/errno.h>
|
#include <l4/api/errno.h>
|
||||||
#include <container.h>
|
#include <container.h>
|
||||||
#include <capability.h>
|
|
||||||
#include <thread.h>
|
#include <thread.h>
|
||||||
#include <tests.h>
|
#include <tests.h>
|
||||||
#include <l4lib/arch/syslib.h>
|
#include <l4lib/arch/syslib.h>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2009 B Labs Ltd.
|
* Copyright (C) 2009 B Labs Ltd.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <capability.h>
|
#include <l4lib/capability/cap_print.h>
|
||||||
#include <l4lib/arch/syscalls.h>
|
#include <l4lib/arch/syscalls.h>
|
||||||
|
|
||||||
static struct capability cap_array[30];
|
static struct capability cap_array[30];
|
||||||
@@ -76,78 +76,6 @@ void cap_grant_single(struct capability *orig, struct capability *share, l4id_t
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void cap_print(struct capability *cap)
|
|
||||||
{
|
|
||||||
printf("Capability id:\t\t\t%d\n", cap->capid);
|
|
||||||
printf("Capability resource id:\t\t%d\n", cap->resid);
|
|
||||||
printf("Capability owner id:\t\t%d\n",cap->owner);
|
|
||||||
|
|
||||||
switch (cap_type(cap)) {
|
|
||||||
case CAP_TYPE_TCTRL:
|
|
||||||
printf("Capability type:\t\t%s\n", "Thread Control");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_EXREGS:
|
|
||||||
printf("Capability type:\t\t%s\n", "Exchange Registers");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_MAP_PHYSMEM:
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Physmem");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_MAP_VIRTMEM:
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Virtmem");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CAP_TYPE_IPC:
|
|
||||||
printf("Capability type:\t\t%s\n", "Ipc");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_UMUTEX:
|
|
||||||
printf("Capability type:\t\t%s\n", "Mutex");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_QUANTITY:
|
|
||||||
printf("Capability type:\t\t%s\n", "Quantitative");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("Capability type:\t\t%s\n", "Unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cap_rtype(cap)) {
|
|
||||||
case CAP_RTYPE_THREAD:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_TGROUP:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread Group");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_SPACE:
|
|
||||||
printf("Capability resource type:\t%s\n", "Space");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CONTAINER:
|
|
||||||
printf("Capability resource type:\t%s\n", "Container");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_THREADPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_SPACEPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Space Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_MUTEXPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Mutex Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_MAPPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Map Pool (PMDS)");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CPUPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Cpu Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CAPPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Capability Pool");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("Capability resource type:\t%s\n", "Unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int caps_read_all(void)
|
int caps_read_all(void)
|
||||||
{
|
{
|
||||||
int ncaps;
|
int ncaps;
|
||||||
@@ -170,9 +98,7 @@ int caps_read_all(void)
|
|||||||
"complete CAP_CONTROL_READ_CAPS request.\n");
|
"complete CAP_CONTROL_READ_CAPS request.\n");
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
//cap_array_print(ncaps, caparray);
|
||||||
for (int i = 0; i < ncaps; i++)
|
|
||||||
cap_print(&cap_array[i]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#include <thread.h>
|
#include <thread.h>
|
||||||
#include <capability.h>
|
|
||||||
#include <container.h>
|
#include <container.h>
|
||||||
|
#include <capability.h>
|
||||||
#include <tests.h>
|
#include <tests.h>
|
||||||
#include <l4/api/errno.h>
|
#include <l4/api/errno.h>
|
||||||
#include <l4lib/arch/syslib.h>
|
#include <l4lib/arch/syslib.h>
|
||||||
|
#include <l4/api/capability.h>
|
||||||
|
|
||||||
int simple_pager_thread(void *arg)
|
int simple_pager_thread(void *arg)
|
||||||
{
|
{
|
||||||
@@ -55,10 +56,11 @@ int simple_pager_thread(void *arg)
|
|||||||
|
|
||||||
int wait_check_test(struct task_ids *ids)
|
int wait_check_test(struct task_ids *ids)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/* Wait for thread to finish */
|
/* Wait for thread to finish */
|
||||||
//result = l4_thread_control(THREAD_WAIT, ids);
|
result = l4_thread_control(THREAD_WAIT, ids);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf("Waiting on (%d)'s exit failed.\n", ids->tid);
|
printf("Waiting on (%d)'s exit failed.\n", ids->tid);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -66,6 +68,7 @@ int wait_check_test(struct task_ids *ids)
|
|||||||
printf("Top-level test has failed\n");
|
printf("Top-level test has failed\n");
|
||||||
}
|
}
|
||||||
/* Else it is a success */
|
/* Else it is a success */
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,11 +38,6 @@ LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace')
|
|||||||
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')]
|
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')]
|
||||||
LIBDEV_CCFLAGS = '-DPLATFORM_' + platform.upper()
|
LIBDEV_CCFLAGS = '-DPLATFORM_' + platform.upper()
|
||||||
|
|
||||||
LIBL4THREAD_RELDIR = 'conts/libl4thread'
|
|
||||||
LIBL4THREAD_DIR = join(PROJROOT, LIBL4THREAD_RELDIR)
|
|
||||||
LIBL4THREAD_LIBPATH = join(BUILDDIR, LIBL4THREAD_RELDIR)
|
|
||||||
LIBL4THREAD_INCLUDE = join(LIBL4THREAD_DIR, 'include')
|
|
||||||
|
|
||||||
LIBMEM_RELDIR = 'conts/libmem'
|
LIBMEM_RELDIR = 'conts/libmem'
|
||||||
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||||
@@ -57,12 +52,10 @@ env = Environment(CC = config.user_toolchain + 'gcc',
|
|||||||
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 = ['libl4thread', 'libl4', 'libmalloc', 'c-userspace', \
|
LIBS = ['libl4', 'libmalloc', 'c-userspace', 'libdev-userspace', \
|
||||||
'libdev-userspace', 'gcc', 'c-userspace'], # libgcc.a - This is required for division routines.
|
'gcc', 'c-userspace'], # libgcc.a - This is required for division routines.
|
||||||
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, \
|
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE],
|
||||||
LIBC_INCLUDE, LIBL4THREAD_INCLUDE],
|
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
|
||||||
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBL4THREAD_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]')
|
src = Glob('*.[cS]')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <l4lib/arch/syslib.h>
|
#include <l4lib/arch/syslib.h>
|
||||||
#include <l4lib/arch/syscalls.h>
|
#include <l4lib/arch/syscalls.h>
|
||||||
#include <l4/api/space.h>
|
#include <l4/api/space.h>
|
||||||
#include <l4thread/thread.h>
|
#include <l4lib/thread/thread.h>
|
||||||
|
|
||||||
/* Symbolic constants */
|
/* Symbolic constants */
|
||||||
#define STACK_SIZE 0x1000
|
#define STACK_SIZE 0x1000
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef __L4_THREAD_H__
|
#ifndef __L4_THREAD_H__
|
||||||
#define __L4_THREAD_H__
|
#define __L4_THREAD_H__
|
||||||
|
|
||||||
#include <libl4/arch/utcb.h>
|
#include <l4lib/arch/utcb.h>
|
||||||
#include <libl4/arch/types.h>
|
#include <l4lib/arch/types.h>
|
||||||
|
|
||||||
struct l4_thread_struct {
|
struct l4_thread_struct {
|
||||||
l4id_t tlid; /* Thread local id */
|
l4id_t tlid; /* Thread local id */
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ struct l4lib_global_list global_tasks = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Function definitions */
|
/* Function definitions */
|
||||||
void global_add_task(struct l4lib_tcb *task)
|
void l4lib_global_add_task(struct l4lib_tcb *task)
|
||||||
{
|
{
|
||||||
BUG_ON(!list_empty(&task->list));
|
BUG_ON(!list_empty(&task->list));
|
||||||
list_insert_tail(&task->list, &global_tasks.list);
|
list_insert_tail(&task->list, &global_tasks.list);
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ extern unsigned long lib_utcb_range_size;
|
|||||||
/* Static variable definitions */
|
/* Static variable definitions */
|
||||||
struct l4_mutex lib_mutex;
|
struct l4_mutex lib_mutex;
|
||||||
|
|
||||||
extern void global_add_task(struct l4lib_tcb *task);
|
|
||||||
|
|
||||||
/* Function definitions */
|
/* Function definitions */
|
||||||
int l4_thread_create(struct task_ids *ids, unsigned int flags,
|
int l4_thread_create(struct task_ids *ids, unsigned int flags,
|
||||||
int (*func)(void *), void *arg)
|
int (*func)(void *), void *arg)
|
||||||
|
|||||||
Reference in New Issue
Block a user