FOC/L4RE: Upstream revision 47

This commit is contained in:
Sebastian Sumpf
2013-02-20 12:17:17 +01:00
parent 34af60da11
commit b22db346c8
127 changed files with 1856 additions and 1965 deletions

View File

@@ -87,7 +87,7 @@ $(OBJ_BASE)/pc:
# deps on disappearing aliases.d-files are not handled...
$(OBJ_BASE)/pkg/.Package.deps: $(L4DIR)/mk/pkgdeps \
$(if $(filter update up,$(MAKECMDGOALS)),Makefile) \
$(if $(filter update up,$(MAKECMDGOALS)),,Makefile) \
$(wildcard $(foreach d,$(ALIASES_DIRS),$(d)/*)) \
$(OBJ_BASE)/pc \
$(wildcard $(foreach d,$(BUILD_SUBDIRS),$(d)/Control))

View File

@@ -6,12 +6,16 @@
* Please see the COPYING-LGPL-2.1 file for details.
*/
#include "support.h"
void
reboot_arch(void) __attribute__((noreturn));
void
reboot_arch(void)
{
for (;;)
Platform_base::platform->reboot();
while (1)
;
}

View File

@@ -286,7 +286,7 @@ processing-of-module-list-failed:
@echo
@exit 1
mod.make.inc: $(GENERAL_D_LOC) $(shell $(call BUILD_MOD_CMD,list))
mod.make.inc $(od)mbi_modules.bin: $(GENERAL_D_LOC) $(shell $(call BUILD_MOD_CMD,list))
@echo Building entry \""$(ENTRY)"\".
$(VERBOSE)$(call BUILD_MOD_CMD,build)

View File

@@ -26,7 +26,7 @@ class Platform_arm_int : public Platform_single_region_ram
void init()
{
static L4::Io_register_block_mmio r(0x16000000);
static L4::Uart_pl011 _uart;
static L4::Uart_pl011 _uart(24019200);
_uart.startup(&r);
set_stdio_uart(&_uart);
}

View File

@@ -27,7 +27,7 @@ class Platform_arm_rv : public Platform_single_region_ram
void init()
{
static L4::Io_register_block_mmio r(0x10009000);
static L4::Uart_pl011 _uart;
static L4::Uart_pl011 _uart(24019200);
_uart.startup(&r);
set_stdio_uart(&_uart);
}

View File

@@ -27,7 +27,7 @@ class Platform_arm_rv_vexpress : public Platform_single_region_ram
void init()
{
static L4::Io_register_block_mmio r(0x10009000);
static L4::Uart_pl011 _uart;
static L4::Uart_pl011 _uart(24019200);
_uart.startup(&r);
set_stdio_uart(&_uart);
}

View File

@@ -21,16 +21,14 @@
#include <l4/drivers/uart_pxa.h>
namespace {
class Platform_arm_tegra2 : public Platform_base
class Platform_arm_tegra2 : public Platform_single_region_ram
{
private:
void some_delay(int d) const
{
for (int i = 0; i < d; i++)
asm volatile("":::"memory");
}
public:
bool probe() { return true; }
void init()
@@ -69,19 +67,12 @@ public:
some_delay(5000);
static L4::Uart_16550 _uart(L4::Uart_16550::Base_rate_pxa);
static L4::Uart_16550 _uart(13478400);
static L4::Io_register_block_mmio r(0x70006300, 2);
_uart.startup(&r);
_uart.change_mode(3, 7876);
_uart.change_mode(3, 115200);
set_stdio_uart(&_uart);
}
void setup_memory_map(l4util_mb_info_t *,
Region_list *ram, Region_list *)
{
ram->add(Region::n(0x0, 448 << 20, ".ram", Region::Ram));
ram->add(Region::n(512 << 20, 1024 << 20, ".ram", Region::Ram));
}
};
}

View File

@@ -37,6 +37,12 @@ public:
Region_list *ram, Region_list *regions) = 0;
virtual bool probe() = 0;
virtual void reboot()
{
while (1)
;
}
// remember the chosen platform
static Platform_base *platform;

View File

@@ -16,6 +16,7 @@ namespace L4
class Uart_pl011 : public Uart
{
public:
Uart_pl011(unsigned freq) : _freq(freq) {}
bool startup(Io_register_block const *);
void shutdown();
bool change_mode(Transfer_mode m, Baud_rate r);
@@ -24,6 +25,9 @@ namespace L4
int char_avail() const;
inline void out_char(char c) const;
int write(char const *s, unsigned long count) const;
private:
unsigned _freq;
};
};

View File

@@ -49,16 +49,18 @@ namespace L4
UART011_IMSC = 0x38,
UART011_MIS = 0x40,
UART011_ICR = 0x44,
};
Default_baud = 115200,
};
bool Uart_pl011::startup(Io_register_block const *regs)
{
_regs = regs;
_regs->write<unsigned int>(UART011_CR, UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE);
_regs->write<unsigned int>(UART011_FBRD, 2);
_regs->write<unsigned int>(UART011_IBRD, 13);
_regs->write<unsigned int>(UART011_LCRH, 0x60);
unsigned fi_val = _freq * 4 / Default_baud;
_regs->write<unsigned int>(UART011_FBRD, fi_val & 0x3f);
_regs->write<unsigned int>(UART011_IBRD, fi_val >> 6);
_regs->write<unsigned int>(UART011_LCRH, UART01x_LCRH_WLEN_8);
_regs->write<unsigned int>(UART011_IMSC, 0);
Poll_timeout_counter i(3000000);
while (i.test() && _regs->read<unsigned int>(UART01x_FR) & UART01x_FR_BUSY)
@@ -88,14 +90,12 @@ namespace L4
bool Uart_pl011::change_mode(Transfer_mode, Baud_rate r)
{
if (r != 115200)
return false;
unsigned long old_cr = _regs->read<unsigned int>(UART011_CR);
_regs->write<unsigned int>(UART011_CR, 0);
_regs->write<unsigned int>(UART011_FBRD, 2);
_regs->write<unsigned int>(UART011_IBRD, 13);
unsigned fi_val = _freq * 4 / r;
_regs->write<unsigned int>(UART011_FBRD, fi_val & 0x3f);
_regs->write<unsigned int>(UART011_IBRD, fi_val >> 6);
_regs->write<unsigned int>(UART011_LCRH, UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN);
_regs->write<unsigned int>(UART011_CR, old_cr);

View File

@@ -23,8 +23,7 @@
*/
#pragma once
#include <l4/sys/ipc.h>
#include <l4/sys/task.h>
#include <l4/sys/types.h>
/**
* \defgroup l4_vm_svm_api VM API for SVM

View File

@@ -20,7 +20,7 @@ PRIVATE_INCDIR_ARCH-x86/perform.s.o = ARCH-x86
include $(L4DIR)/mk/lib.mk
ARCH-x86/perform.o: ARCH-x86/pmc_events.h
ARCH-x86/perform.o ARCH-x86/perform.s.o: ARCH-x86/pmc_events.h
ARCH-x86/pmc_events.h: pmc_events.in
@$(GEN_MESSAGE)
$(VERBOSE)sort < $^ > $(OBJ_DIR)/$(^F).sorted || rm $(OBJ_DIR)/$(^F).sorted

View File

@@ -147,17 +147,19 @@ public:
{ l4vcpu_irq_restore(this, s, utcb, do_event_work_cb, setup_ipc); }
/**
* \brief Halt/block the vCPU.
* \brief Wait for event.
*
* \param utcb The UTCB to use.
* \param do_event_work_cb Call-back function that is called in case an
* event (such as an interrupt) is pending.
* \param setup_ipc Call-back function that is called before an
* IPC operation is called.
*
* Note that event delivery remains disabled after this function returns.
*/
void halt(l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb,
l4vcpu_setup_ipc_t setup_ipc) throw()
{ l4vcpu_halt(this, utcb, do_event_work_cb, setup_ipc); }
void wait_for_event(l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb,
l4vcpu_setup_ipc_t setup_ipc) throw()
{ l4vcpu_wait_for_event(this, utcb, do_event_work_cb, setup_ipc); }
/**
* \brief Set the task of the vCPU.

View File

@@ -141,7 +141,7 @@ l4vcpu_wait(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb,
l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW;
/**
* \brief Halt the vCPU (sleep).
* \brief Wait for event.
* \ingroup api_libvcpu
*
* \param vcpu Pointer to vCPU area.
@@ -150,12 +150,14 @@ l4vcpu_wait(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb,
* awakes and needs to handle an event/IRQ.
* \param setup_ipc Function call-back that is called right before
* any IPC operation.
*
* Note that event delivery remains disabled after this function returns.
*/
L4_CV L4_INLINE
void
l4vcpu_halt(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb,
l4vcpu_event_hndl_t do_event_work_cb,
l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW;
l4vcpu_wait_for_event(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb,
l4vcpu_event_hndl_t do_event_work_cb,
l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW;
/**
@@ -290,12 +292,11 @@ l4vcpu_irq_restore(l4_vcpu_state_t *vcpu, l4vcpu_irq_state_t s,
L4_CV L4_INLINE
void
l4vcpu_halt(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb,
l4vcpu_event_hndl_t do_event_work_cb,
l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW
l4vcpu_wait_for_event(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb,
l4vcpu_event_hndl_t do_event_work_cb,
l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW
{
l4vcpu_wait(vcpu, utcb, L4_IPC_NEVER, do_event_work_cb, setup_ipc);
l4vcpu_irq_enable(vcpu, utcb, do_event_work_cb, setup_ipc);
}
__END_DECLS

View File

@@ -22,11 +22,10 @@
void l4vcpu_print_state_arch(l4_vcpu_state_t *vcpu,
const char *prefix) L4_NOTHROW
{
printf("%svcpu=%p ip=%08lx sp=%08lx trapno=%08lx label=%lx\n",
prefix, vcpu, vcpu->r.ip, vcpu->r.sp, vcpu->r.trapno, vcpu->i.label);
printf("%sip=%08lx sp=%08lx trapno=%08lx\n",
prefix, vcpu->r.ip, vcpu->r.sp, vcpu->r.trapno);
printf("%sax=%08lx dx=%08lx bx=%08lx cx=%08lx\n",
prefix, vcpu->r.ax, vcpu->r.dx, vcpu->r.bx, vcpu->r.cx);
printf("%ssi=%08lx di=%08lx bp=%08lx flags=%08lx\n",
prefix, vcpu->r.si, vcpu->r.di, vcpu->r.bp, vcpu->r.flags);
}

View File

@@ -31,4 +31,3 @@ void l4vcpu_print_state_arch(l4_vcpu_state_t *vcpu,
printf("%sds=%08lx es=%08lx gs=%08lx fs=%08lx\n",
prefix, vcpu->r.ds, vcpu->r.es, vcpu->r.gs, vcpu->r.fs);
}

View File

@@ -27,8 +27,9 @@ l4vcpu_print_state(l4_vcpu_state_t *vcpu,
{
printf("%svcpu=%p state=%x savedstate=%x label=%lx\n",
prefix, vcpu, vcpu->state, vcpu->saved_state, vcpu->i.label);
printf("%ssticky=%x user_task=%lx\n",
prefix, vcpu->sticky_flags, vcpu->user_task << L4_CAP_SHIFT);
printf("%ssticky=%x user_task=%lx pfa=%lx\n",
prefix, vcpu->sticky_flags, vcpu->user_task << L4_CAP_SHIFT,
vcpu->r.pfa);
printf("%sentry_sp=%lx entry_ip=%lx\n",
prefix, vcpu->entry_sp, vcpu->entry_ip);
l4vcpu_print_state_arch(vcpu, prefix);

View File

@@ -19,6 +19,8 @@
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
#include <features.h>
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -18,7 +18,7 @@ DIR_sparc := sparc
SRC_CC = manager.cc l4.cc
SRC_C += spinlock.c mutex.c condvar.c rwlock.c errno.c specific.c \
semaphore.c attr.c barrier.c join.c pthread.c \
cancel.c ptcleanup.c errno-loc.c \
cancel.c ptcleanup.c errno-loc.c signals.c \
sysdeps/$(DIR_$(ARCH))/pspinlock.c
SRC_C_libpthread.a += libc_pthread_init.c
SRC_S = tramp-$(ARCH).S

View File

@@ -0,0 +1,34 @@
/* Handling of signals */
#include <signal.h>
#include <errno.h>
#include <pthread-l4.h>
#include <l4/sys/thread.h>
int pthread_kill(pthread_t thread, int signo);
int pthread_kill(pthread_t thread, int signo)
{
l4_cap_idx_t c = pthread_getl4cap(thread);
if (signo >= _NSIG)
{
errno = EINVAL;
return -1;
}
if (l4_is_invalid_cap(c))
{
errno = ESRCH;
return -1;
}
int x = l4_error(l4_thread_ex_regs(c, ~0UL, ~0UL,
L4_THREAD_EX_REGS_TRIGGER_EXCEPTION));
if (x)
{
errno = EINVAL;
return -1;
}
return x ? -1 : 0;
}

View File

@@ -0,0 +1,12 @@
// prototype from
// pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/common/bits/sigthread.h
#pragma once
#if !defined _SIGNAL_H && !defined _PTHREAD_H
# error "Never include this file directly. Use <pthread.h> instead"
#endif
/* Send signal SIGNO to the given thread. */
extern int pthread_kill (pthread_t __threadid, int __signo) __THROW;

View File

@@ -18,6 +18,7 @@ define SRC_libc/sysdeps/linux_large_file
endef
SRC_libc/sysdeps/linux_arm += aeabi_atexit
SRC_libc/sysdeps/linux_arm += find_exidx
define SRC_libc/sysdeps/linux_sparc__with_soft_fp
soft-fp/q_add
@@ -202,9 +203,28 @@ define SRC_libc/string
endef
define SRC_libc/string_wchar
wcscmp
wcsnlen
wcslen
wcsncpy
wmemcpy
wcsstr
wcscasecmp
wcscpy
wcsncasecmp
wcstok
wcscat
wcscspn
wcspbrk
wcschr
wcsdup
wcsncat
wcsrchr
wcsxfrm
wcschrnul
wcslcpy
wcsncmp
wcsspn
endef
SRC_libc/string_arm := _memcpy
@@ -257,6 +277,7 @@ define SRC_libc/misc
locale/localeconv
locale/nl_langinfo
locale/setlocale
regex/regex_old
search/hcreate_r
search/hdestroy_r
search/hsearch
@@ -325,6 +346,22 @@ define SRC_libc/misc_wchar
wctype/iswctype
wctype/wctype
wctype/_wctype
wctype/towlower
wctype/towupper
wctype/towctrans
wctype/wctrans
wctype/iswxdigit
wctype/iswupper
wctype/iswlower
wctype/iswspace
wctype/iswpunct
wctype/iswprint
wctype/iswgraph
wctype/iswdigit
wctype/iswcntrl
wctype/iswblank
wctype/iswalpha
wctype/iswalnum
endef
define SRC_libc/stdio

View File

@@ -188,6 +188,7 @@ sys/resource.h
sys/select.h
sys/sem.h
sys/shm.h
sys/signal.h
sys/socket.h
sys/soundcard.h
sys/statfs.h