mirror of
https://github.com/drasko/codezero.git
synced 2026-03-09 22:03:15 +01:00
Kernel updates since December 2009
This commit is contained in:
16
conts/test_suite0/include/api/api.h
Normal file
16
conts/test_suite0/include/api/api.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef __TEST_SUITE_API_H__
|
||||
#define __TEST_SUITE_API_H__
|
||||
|
||||
|
||||
int test_api_cctrl(void);
|
||||
int test_api_tctrl(void);
|
||||
int test_api_capctrl(void);
|
||||
int test_api_getid(void);
|
||||
int test_api_mutexctrl(void);
|
||||
int test_api_tswitch(void);
|
||||
int test_api_exregs(void);
|
||||
int test_api_ipc(void);
|
||||
int test_api_irqctrl(void);
|
||||
int test_api_map_unmap(void);
|
||||
|
||||
#endif /* __TEST_SUITE_API_H__ */
|
||||
6
conts/test_suite0/include/capability.h
Normal file
6
conts/test_suite0/include/capability.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __CAPABILITY_H__
|
||||
#define __CAPABILITY_H__
|
||||
|
||||
int caps_read_all();
|
||||
|
||||
#endif /* __CAPABILITY_H__ */
|
||||
13
conts/test_suite0/include/container.h
Normal file
13
conts/test_suite0/include/container.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Autogenerated definitions for this container.
|
||||
*/
|
||||
#ifndef __CONTAINER_H__
|
||||
#define __CONTAINER_H__
|
||||
|
||||
|
||||
#define __CONTAINER_NAME__ "test_suite0"
|
||||
#define __CONTAINER_ID__ 0
|
||||
#define __CONTAINER__ "cont0"
|
||||
|
||||
|
||||
#endif /* __CONTAINER_H__ */
|
||||
44
conts/test_suite0/include/debug.h
Normal file
44
conts/test_suite0/include/debug.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Debug/performance measurements for mm0
|
||||
*
|
||||
* Copyright (C) 2010 B Labs Ltd.
|
||||
*/
|
||||
#ifndef __ARCH_DEBUG_H__
|
||||
#define __ARCH_DEBUG_H__
|
||||
|
||||
#if !defined(CONFIG_DEBUG_PERFMON_USER)
|
||||
|
||||
#include <l4lib/types.h>
|
||||
|
||||
/* Common empty definitions for all arches */
|
||||
static inline u32 perfmon_read_cyccnt() { return 0; }
|
||||
|
||||
static inline void perfmon_reset_start_cyccnt() { }
|
||||
static inline u32 perfmon_read_reset_start_cyccnt() { return 0; }
|
||||
|
||||
#define debug_record_cycles(str)
|
||||
|
||||
#else /* End of CONFIG_DEBUG_PERFMON_USER */
|
||||
|
||||
/* Architecture specific perfmon cycle counting */
|
||||
#include L4LIB_INC_SUBARCH(perfmon.h)
|
||||
|
||||
extern u64 perfmon_total_cycles;
|
||||
extern u64 current_cycles;
|
||||
|
||||
/*
|
||||
* This is for Cortex-A9 running at 400Mhz. 25 / 100000 is
|
||||
* a rewriting of 2.5 nanosec / 1,000,000
|
||||
*/
|
||||
#define debug_record_cycles(str) \
|
||||
{ \
|
||||
current_cycles = perfmon_read_cyccnt(); \
|
||||
perfmon_total_cycles += current_cycles; \
|
||||
printf("%s: took %llu milliseconds\n", str, \
|
||||
current_cycles * 64 * 25 / 100000); \
|
||||
perfmon_reset_start_cyccnt(); \
|
||||
}
|
||||
|
||||
#endif /* End of !CONFIG_DEBUG_PERFMON_USER */
|
||||
|
||||
#endif /* __ARCH_DEBUG_H__ */
|
||||
44
conts/test_suite0/include/fault.h
Normal file
44
conts/test_suite0/include/fault.h
Normal 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__ */
|
||||
16
conts/test_suite0/include/linker.h
Normal file
16
conts/test_suite0/include/linker.h
Normal 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__ */
|
||||
30
conts/test_suite0/include/linker.lds
Normal file
30
conts/test_suite0/include/linker.lds
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Example working linker script for this container.
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
|
||||
vma_start = 0xa0000000;
|
||||
lma_start = 0x100000;
|
||||
offset = vma_start - lma_start;
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = vma_start;
|
||||
.text : AT (ADDR(.text) - offset) { *(.text.head) *(.text) }
|
||||
.rodata : AT (ADDR(.rodata) - offset) { *(.rodata) }
|
||||
.rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) }
|
||||
|
||||
. = ALIGN(4K);
|
||||
.data : AT (ADDR(.data) - offset) { *(.data) }
|
||||
.bss : AT (ADDR(.bss) - offset)
|
||||
{
|
||||
*(.bss)
|
||||
. += 0x1000;
|
||||
. = ALIGN(8);
|
||||
__stack = .;
|
||||
}
|
||||
__end = .;
|
||||
}
|
||||
9
conts/test_suite0/include/macros.h
Normal file
9
conts/test_suite0/include/macros.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef __TEST_MACROS_H__
|
||||
#define __TEST_MACROS_H__
|
||||
|
||||
#define __INC_ARCH(x) <arch/__ARCH__/x>
|
||||
#define __INC_SUBARCH(x) <arch/__ARCH__/__SUBARCH__/x>
|
||||
#define __INC_PLAT(x) <platform/__PLATFORM__/x>
|
||||
#define __INC_GLUE(x) <glue/__ARCH__/x>
|
||||
|
||||
#endif /* __TEST_MACROS_H__ */
|
||||
12
conts/test_suite0/include/memory.h
Normal file
12
conts/test_suite0/include/memory.h
Normal 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__ */
|
||||
69
conts/test_suite0/include/perf.h
Normal file
69
conts/test_suite0/include/perf.h
Normal file
@@ -0,0 +1,69 @@
|
||||
#ifndef __PERF_TESTS_H__
|
||||
#define __PERF_TESTS_H__
|
||||
|
||||
/* Architecture specific perfmon cycle counting */
|
||||
#include <l4lib/types.h>
|
||||
#include <l4lib/macros.h>
|
||||
#include L4LIB_INC_SUBARCH(perfmon.h)
|
||||
|
||||
struct perfmon_cycles {
|
||||
u64 last; /* Last op cycles */
|
||||
u64 min; /* Minimum cycles */
|
||||
u64 max; /* Max cycles */
|
||||
u64 avg; /* Average cycles */
|
||||
u64 total; /* Total cycles */
|
||||
u64 ops; /* Total ops */
|
||||
};
|
||||
|
||||
/*
|
||||
* This is for converting cycle count to timings on
|
||||
* Cortex-A9 running at 400Mhz. 25 / 100000 is
|
||||
* a rewriting of 2.5 nanosec / 1,000,000 in millisec
|
||||
*
|
||||
* 25 / 100 = 2.5nanosec * 10 / 1000 = microseconds
|
||||
*/
|
||||
|
||||
#define CORTEXA9_400MHZ_USEC 25 / 10000
|
||||
#define CORTEXA9_400MHZ_MSEC 25 / 10000000
|
||||
#define USEC_MULTIPLIER CORTEXA9_400MHZ_USEC
|
||||
#define MSEC_MULTIPLIER CORTEXA9_400MHZ_MSEC
|
||||
|
||||
#if !defined(CONFIG_DEBUG_PERFMON_USER)
|
||||
|
||||
|
||||
#define perfmon_record_cycles(ptr, str)
|
||||
|
||||
#else /* End of CONFIG_DEBUG_PERFMON_USER */
|
||||
|
||||
#define perfmon_record_cycles(pcyc, str) \
|
||||
{ \
|
||||
(pcyc)->ops++; \
|
||||
(pcyc)->last = perfmon_read_cyccnt() * 64; \
|
||||
(pcyc)->total += (pcyc)->last; \
|
||||
if ((pcyc)->min > (pcyc)->last) \
|
||||
(pcyc)->min = (pcyc)->last; \
|
||||
if ((pcyc)->max < (pcyc)->last) \
|
||||
(pcyc)->max = (pcyc)->last; \
|
||||
}
|
||||
|
||||
/* Same as above but restarts counter */
|
||||
#define perfmon_checkpoint_cycles(pcyc, str) \
|
||||
{ \
|
||||
(pcyc)->last = perfmon_read_cyccnt(); \
|
||||
(pcyc)->total += pcyc->last; \
|
||||
perfmon_reset_start_cyccnt(); \
|
||||
}
|
||||
#endif /* End of !CONFIG_DEBUG_PERFMON_USER */
|
||||
|
||||
void platform_measure_cpu_cycles(void);
|
||||
void perf_measure_getid_ticks(void);
|
||||
void perf_measure_cpu_cycles(void);
|
||||
void perf_measure_getid(void);
|
||||
void perf_measure_tctrl(void);
|
||||
int perf_measure_exregs(void);
|
||||
void perf_measure_ipc(void);
|
||||
void perf_measure_map(void);
|
||||
void perf_measure_unmap(void);
|
||||
void perf_measure_mutex(void);
|
||||
|
||||
#endif /* __PERF_TESTS_H__ */
|
||||
38
conts/test_suite0/include/project_linker.lds
Normal file
38
conts/test_suite0/include/project_linker.lds
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Example working linker script for this container.
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
|
||||
vma_start = 0xa0000000;
|
||||
lma_start = 0x100000;
|
||||
offset = vma_start - lma_start;
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = vma_start;
|
||||
.text : AT (ADDR(.text) - offset) { *(.text.head) *(.text) }
|
||||
.rodata : AT (ADDR(.rodata) - offset) { *(.rodata) }
|
||||
.rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) }
|
||||
|
||||
. = ALIGN(4K);
|
||||
__data_start = .;
|
||||
.data : AT (ADDR(.data) - offset) { *(.data) }
|
||||
__data_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
|
||||
__bss_end = .;
|
||||
|
||||
__stack_start = .;
|
||||
.stack : AT (ADDR(.stack) - offset)
|
||||
{
|
||||
. += 0x3000;
|
||||
. = ALIGN(4K);
|
||||
__stack = .;
|
||||
}
|
||||
__stack_end = .;
|
||||
__end = .;
|
||||
}
|
||||
18
conts/test_suite0/include/tests.h
Normal file
18
conts/test_suite0/include/tests.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef __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 test_smp();
|
||||
int test_performance();
|
||||
int test_api();
|
||||
int test_cli_serv();
|
||||
int test_mthread();
|
||||
|
||||
#endif /* __TESTS_H__ */
|
||||
19
conts/test_suite0/include/thread.h
Normal file
19
conts/test_suite0/include/thread.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef __THREAD_H__
|
||||
#define __THREAD_H__
|
||||
|
||||
#include <l4lib/macros.h>
|
||||
#include L4LIB_INC_ARCH(syslib.h)
|
||||
#include L4LIB_INC_ARCH(syscalls.h)
|
||||
#include <l4lib/exregs.h>
|
||||
#include <l4/api/thread.h>
|
||||
|
||||
|
||||
int thread_create(int (*func)(void *), void *args, unsigned int flags,
|
||||
struct task_ids *new_ids);
|
||||
|
||||
/* For same space */
|
||||
#define STACK_SIZE 0x1000
|
||||
|
||||
#define THREADS_TOTAL 10
|
||||
|
||||
#endif /* __THREAD_H__ */
|
||||
9
conts/test_suite0/include/timer.h
Normal file
9
conts/test_suite0/include/timer.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef __PERF_TESTS_TIMER_H__
|
||||
#define __PERF_TESTS_TIMER_H__
|
||||
|
||||
#include <libdev/timer.h>
|
||||
|
||||
extern unsigned long timer_base;
|
||||
void perf_timer_init(void);
|
||||
|
||||
#endif /* __PERF_TESTS_TIMER_H__ */
|
||||
Reference in New Issue
Block a user