2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Dummy functions to make the damn thing link
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2006-04-07
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2006-2017 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <base/env.h>
|
2016-05-04 12:27:17 +02:00
|
|
|
#include <base/log.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
#include <base/stdint.h>
|
|
|
|
#include <base/sleep.h>
|
2015-06-15 14:53:59 +02:00
|
|
|
#include <base/thread.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
#include <util/string.h>
|
|
|
|
|
|
|
|
using namespace Genode;
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void __cxa_pure_virtual()
|
|
|
|
{
|
2016-05-04 12:27:17 +02:00
|
|
|
Genode::warning("cxa pure virtual function called, return addr is ",
|
|
|
|
__builtin_return_address(0));
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void __pure_virtual()
|
|
|
|
{
|
2016-05-04 12:27:17 +02:00
|
|
|
Genode::warning("pure virtual function called");
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prototype for exit-handler support function provided by '_main.cc'
|
|
|
|
*/
|
|
|
|
extern int genode___cxa_atexit(void(*func)(void*), void *arg,
|
|
|
|
void *dso_handle);
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" int __cxa_atexit(void(*func)(void*), void *arg,
|
|
|
|
void *dso_handle)
|
|
|
|
{
|
|
|
|
return genode___cxa_atexit(func, arg, dso_handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-09 17:41:04 +02:00
|
|
|
/**
|
|
|
|
* Prototype for finalize support function provided by '_main.cc'
|
|
|
|
*/
|
|
|
|
extern int genode___cxa_finalize(void *dso);
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void __cxa_finalize(void *dso)
|
|
|
|
{
|
|
|
|
genode___cxa_finalize(dso);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
/***********************************
|
|
|
|
** Support required for ARM EABI **
|
|
|
|
***********************************/
|
|
|
|
|
|
|
|
|
2014-02-05 14:42:15 +01:00
|
|
|
extern "C" int __aeabi_atexit(void *arg, void(*func)(void*),
|
|
|
|
void *dso_handle)
|
|
|
|
{
|
|
|
|
return genode___cxa_atexit(func, arg, dso_handle);
|
|
|
|
}
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
extern "C" __attribute__((weak))
|
|
|
|
void *__tls_get_addr()
|
|
|
|
{
|
|
|
|
static long dummy_tls;
|
|
|
|
return &dummy_tls;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Not needed for exception-handling init on ARM EABI,
|
|
|
|
* but called from 'init_exception'
|
|
|
|
*/
|
|
|
|
extern "C" __attribute__((weak))
|
|
|
|
void __register_frame(void *) { }
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Needed to build for OKL4-gta01 with ARM EABI
|
|
|
|
*/
|
|
|
|
extern "C" __attribute__((weak)) void raise()
|
|
|
|
{
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 19:07:09 +02:00
|
|
|
warning("cxx: raise called - not implemented");
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************
|
|
|
|
** Support for libsupc++ **
|
|
|
|
***************************/
|
|
|
|
|
|
|
|
extern "C" void *abort(void)
|
|
|
|
{
|
2016-05-04 12:27:17 +02:00
|
|
|
Genode::Thread const * const myself = Genode::Thread::myself();
|
|
|
|
Thread::Name name = "unknown";
|
2015-06-15 14:53:59 +02:00
|
|
|
|
|
|
|
if (myself)
|
2016-05-04 12:27:17 +02:00
|
|
|
name = myself->name();
|
|
|
|
|
|
|
|
Genode::warning("abort called - thread: ", name.string());
|
2015-06-15 14:53:59 +02:00
|
|
|
|
2015-06-29 17:26:30 +02:00
|
|
|
/* Notify the parent of failure */
|
2016-05-04 12:27:17 +02:00
|
|
|
if (name != "main")
|
2017-01-09 15:18:49 +01:00
|
|
|
env_deprecated()->parent()->exit(1);
|
2015-06-29 17:26:30 +02:00
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
sleep_forever();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void *fputc(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void *fputs(const char *s, void *) {
|
2016-05-04 12:27:17 +02:00
|
|
|
Genode::warning("C++ runtime: ", s);
|
2011-12-22 16:19:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void *fwrite(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" int memcmp(const void *p0, const void *p1, size_t size)
|
|
|
|
{
|
|
|
|
return Genode::memcmp(p0, p1, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __attribute__((weak))
|
|
|
|
void *memcpy(void *dst, void *src, size_t n)
|
|
|
|
{
|
|
|
|
return Genode::memcpy(dst, src, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __attribute__((weak))
|
|
|
|
void *memmove(void *dst, void *src, size_t n)
|
|
|
|
{
|
|
|
|
return Genode::memmove(dst, src, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __attribute__((weak))
|
|
|
|
void *memset(void *s, int c, size_t n)
|
|
|
|
{
|
|
|
|
return Genode::memset(s, c, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void *stderr(void) {
|
2016-05-04 12:27:17 +02:00
|
|
|
Genode::warning("stderr - not yet implemented");
|
2011-12-22 16:19:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Used when having compiled libsupc++ with the FreeBSD libc
|
|
|
|
*/
|
|
|
|
struct FILE;
|
|
|
|
FILE *__stderrp;
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void *strcat(void)
|
|
|
|
{
|
2016-05-04 12:27:17 +02:00
|
|
|
Genode::warning("strcat - not yet implemented");
|
2011-12-22 16:19:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" int strncmp(const char *s1, const char *s2, size_t n)
|
|
|
|
{
|
|
|
|
return Genode::strcmp(s1, s2, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" char *strcpy(char *dest, const char *src)
|
|
|
|
{
|
|
|
|
return Genode::strncpy(dest, src, ~0UL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" size_t strlen(const char *s)
|
|
|
|
{
|
|
|
|
return Genode::strlen(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" int strcmp(const char *s1, const char *s2)
|
|
|
|
{
|
|
|
|
return Genode::strcmp(s1, s2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Needed by ARM EABI (gcc-4.4 Codesourcery release1039)
|
|
|
|
*/
|
|
|
|
extern "C" int sprintf(char *str, const char *format, ...)
|
|
|
|
{
|
2016-05-04 12:27:17 +02:00
|
|
|
Genode::warning("sprintf - not implemented");
|
2011-12-22 16:19:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************
|
|
|
|
** Support for stack protection **
|
|
|
|
**********************************/
|
|
|
|
|
|
|
|
extern "C" __attribute__((weak)) void __stack_chk_fail_local(void)
|
|
|
|
{
|
2016-05-04 12:27:17 +02:00
|
|
|
Genode::error("Violated stack boundary");
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|