Added memory backend
Updated by Viktor Reusch for the new l4re-base-25.08.0. Co-authored-by: vreusch <viktor.reusch@barkhauseninstitut.org>
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
requires: xyz
|
||||
requires: libstdc++ libc_be_mem xyz
|
||||
provides: abc
|
||||
maintainer: your@email.example.com
|
||||
|
||||
@@ -8,6 +8,6 @@ SRC_C = main.c
|
||||
SRC_CC =
|
||||
|
||||
# list requirements of your program here
|
||||
REQUIRES_LIBS =
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -10,4 +10,6 @@ SRC_CC-$(CONFIG_CONS_USE_ASYNC_FE) += async_vcon_fe.cc
|
||||
REQUIRES_LIBS = libstdc++ cxx_libc_io cxx_io
|
||||
REQUIRES_LIBS-$(CONFIG_CONS_USE_ASYNC_FE) = libpthread
|
||||
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
requires: stdlibs
|
||||
requires: stdlibs libstdc++ libc_be_mem
|
||||
Maintainer: adam@os.inf.tu-dresden.de
|
||||
|
||||
@@ -4,6 +4,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_clntsrv-server ex_clntsrv-client
|
||||
SRC_CC_ex_clntsrv-server = server.cc
|
||||
SRC_CC_ex_clntsrv-client = client.cc
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
requires: libstdc++ libc_be_mem
|
||||
|
||||
# color, fractal, spectrum
|
||||
optional: l4re_c-util
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_fb_spectrum_c ex_fb_spectrum_cc
|
||||
SRC_CC_ex_fb_spectrum_cc = spectrum.cc
|
||||
SRC_C_ex_fb_spectrum_c = spectrum_c.c
|
||||
REQUIRES_LIBS = libevent l4re_c-util
|
||||
REQUIRES_LIBS = libevent l4re_c-util libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
requires: stdlibs
|
||||
requires: stdlibs libstdc++ libc_be_mem
|
||||
|
||||
# input, led, uart
|
||||
optional: libstdc++ libio-vbus
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_gpio_input
|
||||
SRC_CC = gpio_input.cc
|
||||
REQUIRES_LIBS = libstdc++ libio-vbus
|
||||
REQUIRES_LIBS = libio-vbus libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_gpio_led
|
||||
SRC_CC = gpio_led.cc
|
||||
REQUIRES_LIBS = libstdc++ libio-vbus
|
||||
REQUIRES_LIBS = libio-vbus libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
PKGDIR ?= ..
|
||||
L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
REQUIRES_LIBS = libstdc++ libio-vbus drivers_uart libio
|
||||
REQUIRES_LIBS = libio-vbus drivers_uart libio libc_be_mem libstdc++
|
||||
|
||||
TARGET = rpi_uart
|
||||
SRC_CC = main.cc
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
requires: stdlibs
|
||||
requires: stdlibs libstdc++ libc_be_mem
|
||||
|
||||
# boost, cppunit, stdthread
|
||||
optional: libstdc++
|
||||
|
||||
@@ -4,6 +4,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = inputtst
|
||||
SRC_C = main.c
|
||||
DEPENDS_PKGS = input
|
||||
REQUIRES_LIBS = input
|
||||
REQUIRES_LIBS = input libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,5 +4,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_l4re_ma+rm_cc
|
||||
|
||||
SRC_CC = ma+rm.cc
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,5 +4,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_periodic_task
|
||||
|
||||
SRC_CC = main.cc
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,5 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_l4re_physmem_cc
|
||||
SRC_CC = physmem.cc
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,5 +4,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_l4re_ds_clnt ex_l4re_ds_srv
|
||||
SRC_CC_ex_l4re_ds_clnt = ds_clnt.cc
|
||||
SRC_CC_ex_l4re_ds_srv = ds_srv.cc
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_l4re_ma+rm_c
|
||||
SRC_C = ma+rm.c
|
||||
REQUIRES_LIBS = l4re_c-util
|
||||
REQUIRES_LIBS = l4re_c-util libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,6 +4,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_smap-server ex_smap-client
|
||||
SRC_CC_ex_smap-server = server.cc
|
||||
SRC_CC_ex_smap-client = client.cc
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = uclibc_thread_safe
|
||||
SRC_CC = main.cc
|
||||
REQUIRES_LIBS = libpthread
|
||||
REQUIRES_LIBS = libpthread libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_libio
|
||||
SRC_C = main.c
|
||||
REQUIRES_LIBS = libio libirq
|
||||
REQUIRES_LIBS = libio libirq libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,7 +4,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
SRC_C_ex_libirq_async = async_isr.c
|
||||
SRC_C_ex_libirq_loop = loop.c
|
||||
TARGET = ex_libirq_async ex_libirq_loop
|
||||
REQUIRES_LIBS = libirq libio
|
||||
REQUIRES_LIBS = libirq libio libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
SRC_C = main.c
|
||||
TARGET = rtc_test
|
||||
DEPENDS_PKGS = rtc
|
||||
REQUIRES_LIBS = rtc
|
||||
DEPENDS_PKGS = rtc libc_be_mem libstdc++
|
||||
REQUIRES_LIBS = rtc libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_shmc
|
||||
SRC_C = prodcons.c
|
||||
REQUIRES_LIBS = shmc libpthread
|
||||
REQUIRES_LIBS = shmc libpthread libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
requires: libc_be_mem
|
||||
|
||||
# cyclichpet, eb_leds, eb_leds_gfx, hpet
|
||||
optional: libio
|
||||
|
||||
|
||||
@@ -3,5 +3,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = cat
|
||||
SRC_C = cat.c
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_eb_leds
|
||||
SRC_C = eb_leds.c
|
||||
REQUIRES_LIBS = libio
|
||||
REQUIRES_LIBS = libio libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,5 +3,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = reboot
|
||||
SRC_C = main.c
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,5 +4,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_hello_shared
|
||||
MODE = shared
|
||||
SRC_C = main.c
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
requires: stdlibs
|
||||
requires: stdlibs libc_be_mem
|
||||
|
||||
# aliens, isr, singlestep, start-with-exc, utcb-ipc, vm-tz
|
||||
optional: l4re_c-util
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_aliens
|
||||
SRC_C = main.c
|
||||
REQUIRES_LIBS = l4re_c-util
|
||||
REQUIRES_LIBS = l4re_c-util libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,5 +3,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = dump_obj
|
||||
SRC_CC = dump_obj.cc
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_ipc1
|
||||
SRC_C = ipc_example.c
|
||||
REQUIRES_LIBS = libpthread
|
||||
REQUIRES_LIBS = libpthread libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_isr
|
||||
SRC_C = main.c
|
||||
REQUIRES_LIBS = l4re_c-util
|
||||
REQUIRES_LIBS = l4re_c-util libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,5 +4,6 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_map_irq_client ex_map_irq_server
|
||||
SRC_CC_ex_map_irq_client = client.cc
|
||||
SRC_CC_ex_map_irq_server = server.cc
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,7 +4,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_thread_migrate ex_thread_migrate_irq
|
||||
SRC_CC_ex_thread_migrate = thread_migrate.cc
|
||||
SRC_CC_ex_thread_migrate_irq = thread_migrate_irq.cc
|
||||
REQUIRES_LIBS = libpthread
|
||||
REQUIRES_LIBS = libpthread libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,7 +4,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_singlestep
|
||||
SYSTEMS = x86-l4f amd64-l4f
|
||||
SRC_C = main.c
|
||||
REQUIRES_LIBS = l4re_c-util
|
||||
REQUIRES_LIBS = l4re_c-util libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,7 +4,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = ex_start-with-exc
|
||||
SYSTEMS = x86-l4f arm-l4f arm64-l4f
|
||||
SRC_C = main.c
|
||||
REQUIRES_LIBS = l4re_c-util
|
||||
REQUIRES_LIBS = l4re_c-util libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
PKGDIR ?= ..
|
||||
L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
TARGET = ex_timeouts
|
||||
SRC_C = main.c
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_uirq
|
||||
SRC_CC = ex_uirq.cc
|
||||
REQUIRES_LIBS = libstdc++ libpthread
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++ libpthread
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -2,7 +2,7 @@ PKGDIR ?= ..
|
||||
L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_utcb_ipc
|
||||
REQUIRES_LIBS = l4re_c-util
|
||||
REQUIRES_LIBS = l4re_c-util libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
SRC_C = main.c
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = ex_vcpu
|
||||
SRC_CC = vcpu.cc
|
||||
REQUIRES_LIBS = libvcpu cxx_io cxx_libc_io
|
||||
REQUIRES_LIBS = libvcpu cxx_io cxx_libc_io libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -5,7 +5,7 @@ TARGET = ex_vmtest
|
||||
SYSTEMS = x86-l4f amd64-l4f
|
||||
SRC_S = guest.S
|
||||
SRC_CC = vm.cc vmx.cc svm.cc main.cc
|
||||
REQUIRES_LIBS = libvcpu l4util
|
||||
REQUIRES_LIBS = libvcpu l4util libc_be_mem libstdc++
|
||||
DEPENDS_PKGS = $(REQUIRES_LIBS)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
requires: libdrivers-lcd x86emu_int10 stdlibs libio-vbus
|
||||
requires: libdrivers-lcd x86emu_int10 stdlibs libio-vbus libstdc++ libc_be_mem
|
||||
maintainer: adam@os.inf.tu-dresden.de
|
||||
|
||||
@@ -11,7 +11,7 @@ REQUIRES_LIBS_x86-l4f = x86emu_int10
|
||||
REQUIRES_LIBS_amd64-l4f = x86emu_int10
|
||||
REQUIRES_LIBS_arm-l4f = libdrivers-lcd
|
||||
REQUIRES_LIBS_arm64-l4f = libdrivers-lcd
|
||||
REQUIRES_LIBS = libc_support_misc libio-vbus
|
||||
REQUIRES_LIBS = libc_support_misc libio-vbus libc_be_mem libstdc++
|
||||
|
||||
DEFINES = -DSPLASHNAME=gimp_image \
|
||||
-DSPLASHNAME_RUN_LENGTH_DECODE=GIMP_IMAGE_RUN_LENGTH_DECODE
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
requires: stdlibs
|
||||
requires: stdlibs libstdc++ libc_be_mem
|
||||
Maintainer: adam@os.inf.tu-dresden.de
|
||||
|
||||
@@ -4,4 +4,6 @@ L4DIR ?= $(PKGDIR)/../..
|
||||
TARGET = hello
|
||||
SRC_C = main.c
|
||||
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#MODE := shared
|
||||
TARGET = io
|
||||
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
DEFINES-$(CONFIG_L4IO_PCIID_DB) += -DCONFIG_L4IO_PCIID_DB
|
||||
|
||||
SUBDIRS = drivers
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
requires: stdlibs
|
||||
requires: stdlibs libstdc++ libc_be_mem
|
||||
Maintainer: adam@l4re.org
|
||||
|
||||
@@ -4,7 +4,7 @@ L4DIR ?= $(PKGDIR)/../..
|
||||
TARGET = ipcbench ipcbench_parallel \
|
||||
ipcbench_client ipcbench_server \
|
||||
syscallbench syscallbench_parallel
|
||||
REQUIRES_LIBS = libpthread
|
||||
REQUIRES_LIBS = libc_be_mem libstdc++ libpthread
|
||||
SRC_C_ipcbench = ipcbench.c ipc_common.c
|
||||
SRC_C_ipcbench_parallel = ipcbench_parallel.c ipc_common.c
|
||||
SRC_C_ipcbench_client = ipcclient.c
|
||||
|
||||
@@ -29,7 +29,7 @@ DEFINES += -DL4_CXX_NO_EXCEPTION_BACKTRACE -DL4_LOADER_RELOC_BASE=$(DEFAULT_RELO
|
||||
|
||||
REQUIRES_LIBS := cxx_io cxx_libc_io libc_minimal libsupc++_minimal libloader \
|
||||
libc_minimal_l4re libumalloc
|
||||
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc --wrap=aligned_alloc --wrap=calloc
|
||||
CXXFLAGS += $(CXXFLAGS_LOW_LEVEL)
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -24,23 +24,26 @@ struct Vfs_init
|
||||
cxx::Static_container<L4Re::Vfs::File_factory_t<L4Re::Namespace, L4Re::Core::Ns_dir> > ns_dir;
|
||||
cxx::Static_container<L4Re::Vfs::File_factory_t<L4::Vcon, L4Re::Core::Vcon_stream> > vcon_stream;
|
||||
|
||||
// This is part of an ugly hack to avoid calling malloc here.
|
||||
char fac_items[3*sizeof(Vfs::File_factory_item)];
|
||||
|
||||
Vfs_init()
|
||||
{
|
||||
vfs.construct();
|
||||
__rtld_l4re_env_posix_vfs_ops = vfs;
|
||||
ns_dir.construct();
|
||||
auto ns_ptr = cxx::ref_ptr(ns_dir.get());
|
||||
vfs->register_file_factory(ns_ptr);
|
||||
vfs->register_file_factory(ns_ptr, &fac_items[0]);
|
||||
ns_ptr.release(); // prevent deletion of static object
|
||||
|
||||
ro_file.construct();
|
||||
auto ro_ptr = cxx::ref_ptr(ro_file.get());
|
||||
vfs->register_file_factory(ro_ptr);
|
||||
vfs->register_file_factory(ro_ptr, &fac_items[sizeof(Vfs::File_factory_item)]);
|
||||
ro_ptr.release(); // prevent deletion of static object
|
||||
|
||||
vcon_stream.construct();
|
||||
auto vcon_ptr = cxx::ref_ptr(vcon_stream.get());
|
||||
vfs->register_file_factory(vcon_ptr);
|
||||
vfs->register_file_factory(vcon_ptr, &fac_items[2*sizeof(Vfs::File_factory_item)]);
|
||||
vcon_ptr.release(); // prevent deletion of static object
|
||||
}
|
||||
};
|
||||
|
||||
@@ -134,6 +134,7 @@ public:
|
||||
L4Re::Vfs::File_system_list file_system_list() noexcept override;
|
||||
|
||||
int register_file_factory(cxx::Ref_ptr<L4Re::Vfs::File_factory> f) noexcept override;
|
||||
int register_file_factory(cxx::Ref_ptr<L4Re::Vfs::File_factory> f, void *x) noexcept;
|
||||
int unregister_file_factory(cxx::Ref_ptr<L4Re::Vfs::File_factory> f) noexcept override;
|
||||
Ref_ptr<L4Re::Vfs::File_factory> get_file_factory(int proto) noexcept override;
|
||||
Ref_ptr<L4Re::Vfs::File_factory> get_file_factory(char const *proto_name) noexcept override;
|
||||
@@ -144,14 +145,6 @@ public:
|
||||
void *malloc(size_t size) noexcept override { return Vfs_config::malloc(size); }
|
||||
void free(void *m) noexcept override { Vfs_config::free(m); }
|
||||
|
||||
private:
|
||||
Root_mount_tree _root_mount;
|
||||
L4Re::Core::Env_dir _root;
|
||||
Ref_ptr<L4Re::Vfs::File> _cwd;
|
||||
Fd_store fds;
|
||||
|
||||
L4Re::Vfs::File_system *_fs_registry;
|
||||
|
||||
struct File_factory_item : cxx::H_list_item_t<File_factory_item>
|
||||
{
|
||||
cxx::Ref_ptr<L4Re::Vfs::File_factory> f;
|
||||
@@ -163,6 +156,14 @@ private:
|
||||
File_factory_item &operator = (File_factory_item const &) = delete;
|
||||
};
|
||||
|
||||
private:
|
||||
Root_mount_tree _root_mount;
|
||||
L4Re::Core::Env_dir _root;
|
||||
Ref_ptr<L4Re::Vfs::File> _cwd;
|
||||
Fd_store fds;
|
||||
|
||||
L4Re::Vfs::File_system *_fs_registry;
|
||||
|
||||
cxx::H_list_t<File_factory_item> _file_factories;
|
||||
|
||||
l4_addr_t _anon_offset;
|
||||
@@ -272,6 +273,20 @@ Vfs::register_file_factory(cxx::Ref_ptr<L4Re::Vfs::File_factory> f) noexcept
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Vfs::register_file_factory(cxx::Ref_ptr<L4Re::Vfs::File_factory> f, void *x) noexcept
|
||||
{
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
if (!x)
|
||||
return -ENOMEM;
|
||||
|
||||
auto ff = new (x, cxx::Nothrow()) File_factory_item(f);
|
||||
_file_factories.push_front(ff);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Vfs::unregister_file_factory(cxx::Ref_ptr<L4Re::Vfs::File_factory> f) noexcept
|
||||
{
|
||||
|
||||
@@ -14,3 +14,5 @@ CXXFLAGS += -fvisibility=hidden
|
||||
# No exception information as unwinder code might use malloc and friends
|
||||
DEFINES += -DNOT_IN_libc -DL4_NO_RTTI
|
||||
CXXFLAGS += -include libc-symbols.h -fno-exceptions -fno-rtti
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
extern int weak_function __libc_free_aligned(void *ptr) attribute_hidden;
|
||||
|
||||
#ifdef L_malloc
|
||||
void *malloc(size_t size)
|
||||
void *__wrap_malloc(size_t size)
|
||||
{
|
||||
void *result;
|
||||
|
||||
@@ -80,7 +80,7 @@ void * calloc(size_t nmemb, size_t lsize)
|
||||
#endif
|
||||
|
||||
#ifdef L_realloc
|
||||
void *realloc(void *ptr, size_t size)
|
||||
void *__wrap_realloc(void *ptr, size_t size)
|
||||
{
|
||||
void *newptr = NULL;
|
||||
|
||||
@@ -102,7 +102,7 @@ void *realloc(void *ptr, size_t size)
|
||||
#endif
|
||||
|
||||
#ifdef L_free
|
||||
void free(void *ptr)
|
||||
void __wrap_free(void *ptr)
|
||||
{
|
||||
if (unlikely(ptr == NULL))
|
||||
return;
|
||||
|
||||
@@ -268,7 +268,7 @@ void attribute_hidden __malloc_consolidate(mstate av)
|
||||
|
||||
|
||||
/* ------------------------------ free ------------------------------ */
|
||||
void free(void* mem)
|
||||
void __wrap_free(void* mem)
|
||||
{
|
||||
mstate av;
|
||||
|
||||
@@ -414,4 +414,4 @@ void free(void* mem)
|
||||
}
|
||||
|
||||
/* glibc compatibilty */
|
||||
weak_alias(free, __libc_free)
|
||||
weak_alias(__wrap_free, __libc_free)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "malloc.h"
|
||||
|
||||
void __wrap_free(void *);
|
||||
|
||||
__UCLIBC_MUTEX_INIT(__malloc_lock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP);
|
||||
|
||||
@@ -707,7 +708,7 @@ static void* __malloc_alloc(size_t nb, mstate av)
|
||||
if (old_size >= MINSIZE) {
|
||||
size_t tt = av->trim_threshold;
|
||||
av->trim_threshold = (size_t)(-1);
|
||||
free(chunk2mem(old_top));
|
||||
__wrap_free(chunk2mem(old_top));
|
||||
av->trim_threshold = tt;
|
||||
}
|
||||
}
|
||||
@@ -800,7 +801,7 @@ static int __malloc_largebin_index(unsigned long sz)
|
||||
|
||||
|
||||
/* ------------------------------ malloc ------------------------------ */
|
||||
void* malloc(size_t bytes)
|
||||
void* __wrap_malloc(size_t bytes)
|
||||
{
|
||||
mstate av;
|
||||
|
||||
@@ -1161,4 +1162,4 @@ DONE:
|
||||
}
|
||||
|
||||
/* glibc compatibilty */
|
||||
weak_alias(malloc, __libc_malloc)
|
||||
weak_alias(__wrap_malloc, __libc_malloc)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
/* ------------------------------ realloc ------------------------------ */
|
||||
void* realloc(void* oldmem, size_t bytes)
|
||||
void* __wrap_realloc(void* oldmem, size_t bytes)
|
||||
{
|
||||
mstate av;
|
||||
|
||||
@@ -239,4 +239,4 @@ void* realloc(void* oldmem, size_t bytes)
|
||||
}
|
||||
|
||||
/* glibc compatibilty */
|
||||
weak_alias(realloc, __libc_realloc)
|
||||
weak_alias(__wrap_realloc, __libc_realloc)
|
||||
|
||||
@@ -266,7 +266,7 @@ __free_to_heap (void *mem, struct heap_free_area **heap
|
||||
}
|
||||
|
||||
void
|
||||
free (void *mem)
|
||||
__wrap_free (void *mem)
|
||||
{
|
||||
free_to_heap (mem, &__malloc_heap, &__malloc_heap_lock);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ __malloc_from_heap (size_t size, struct heap_free_area **heap
|
||||
}
|
||||
|
||||
void *
|
||||
malloc (size_t size)
|
||||
__wrap_malloc (size_t size)
|
||||
{
|
||||
void *mem;
|
||||
#ifdef MALLOC_DEBUGGING
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
void *
|
||||
realloc (void *mem, size_t new_size)
|
||||
__wrap_realloc (void *mem, size_t new_size)
|
||||
{
|
||||
size_t size;
|
||||
char *base_mem;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Provides: libc_be_socket_noop libc_be_l4re libc_support_misc
|
||||
libc_be_fs_noop libc_be_math libc_be_l4refile libinitcwd
|
||||
libc_be_minimal_log_io libmount libc_be_sig
|
||||
libc_be_sem_noop libc_be_static_heap
|
||||
libc_be_sem_noop libc_be_static_heap libc_be_mem
|
||||
Requires: l4re libl4re-vfs libc-headers
|
||||
Maintainer: adam@os.inf.tu-dresden.de
|
||||
|
||||
12
src/l4/pkg/l4re-core/libc_backends/lib/l4re_mem/Makefile
Normal file
12
src/l4/pkg/l4re-core/libc_backends/lib/l4re_mem/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
PKGDIR ?= ../..
|
||||
L4DIR ?= $(PKGDIR)/../../..
|
||||
|
||||
TARGET = libc_be_mem.a libc_be_mem.so
|
||||
LINK_INCR = libc_be_mem.a
|
||||
PC_FILENAME = libc_be_mem
|
||||
REQUIRES_LIBS = l4re
|
||||
SRC_CC = mem.cc
|
||||
|
||||
include $(L4DIR)/mk/lib.mk
|
||||
|
||||
LDFLAGS := $(filter-out -gc-sections,$(LDFLAGS))
|
||||
32
src/l4/pkg/l4re-core/libc_backends/lib/l4re_mem/mem.cc
Normal file
32
src/l4/pkg/l4re-core/libc_backends/lib/l4re_mem/mem.cc
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* \file libc_backends/l4re_mem/mem.cc
|
||||
*/
|
||||
/*
|
||||
* (c) 2004-2009 Technische Universität Dresden
|
||||
* This file is part of TUD:OS and distributed under the terms of the
|
||||
* GNU Lesser General Public License 2.1.
|
||||
* Please see the COPYING-LGPL-2.1 file for details.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
|
||||
void *malloc(size_t size) throw()
|
||||
{
|
||||
void *data = 0;
|
||||
enter_kdebug("malloc");
|
||||
return (void*)data;
|
||||
}
|
||||
|
||||
|
||||
void free(void *p) throw()
|
||||
{
|
||||
if (p)
|
||||
enter_kdebug("free");
|
||||
}
|
||||
|
||||
void *realloc(void *p, size_t size) throw()
|
||||
{
|
||||
void *data = 0;
|
||||
enter_kdebug("realloc");
|
||||
return (void*)data;
|
||||
}
|
||||
@@ -28,6 +28,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
void *__wrap_malloc();
|
||||
|
||||
// Common logic for version locks.
|
||||
struct version_lock
|
||||
{
|
||||
@@ -402,7 +404,7 @@ btree_allocate_node (struct btree *t, bool inner)
|
||||
|
||||
// No free node available, allocate a new one.
|
||||
struct btree_node *new_node
|
||||
= (struct btree_node *) (malloc (sizeof (struct btree_node)));
|
||||
= (struct btree_node *) (__wrap_malloc (sizeof (struct btree_node)));
|
||||
version_lock_initialize_locked_exclusive (
|
||||
&(new_node->version_lock)); // initialize the node in locked state.
|
||||
new_node->entry_count = 0;
|
||||
|
||||
@@ -28,6 +28,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
void *__wrap_malloc();
|
||||
|
||||
// Common logic for version locks.
|
||||
struct version_lock
|
||||
{
|
||||
@@ -402,7 +404,7 @@ btree_allocate_node (struct btree *t, bool inner)
|
||||
|
||||
// No free node available, allocate a new one.
|
||||
struct btree_node *new_node
|
||||
= (struct btree_node *) (malloc (sizeof (struct btree_node)));
|
||||
= (struct btree_node *) (__wrap_malloc (sizeof (struct btree_node)));
|
||||
version_lock_initialize_locked_exclusive (
|
||||
&(new_node->version_lock)); // initialize the node in locked state.
|
||||
new_node->entry_count = 0;
|
||||
|
||||
@@ -28,6 +28,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
void *__wrap_malloc(size_t);
|
||||
void __wrap_free(void *);
|
||||
|
||||
// Common logic for version locks.
|
||||
struct version_lock
|
||||
{
|
||||
@@ -362,7 +365,7 @@ btree_destroy (struct btree *t)
|
||||
while (t->free_list)
|
||||
{
|
||||
struct btree_node *next = t->free_list->content.children[0].child;
|
||||
free (t->free_list);
|
||||
__wrap_free (t->free_list);
|
||||
t->free_list = next;
|
||||
}
|
||||
}
|
||||
@@ -401,7 +404,7 @@ btree_allocate_node (struct btree *t, bool inner)
|
||||
|
||||
// No free node available, allocate a new one.
|
||||
struct btree_node *new_node
|
||||
= (struct btree_node *) malloc (sizeof (struct btree_node));
|
||||
= (struct btree_node *) __wrap_malloc (sizeof (struct btree_node));
|
||||
// Initialize the node in locked state.
|
||||
version_lock_initialize_locked_exclusive (&new_node->version_lock);
|
||||
new_node->entry_count = 0;
|
||||
|
||||
@@ -37,14 +37,16 @@
|
||||
#include <new>
|
||||
|
||||
#if _GLIBCXX_HOSTED
|
||||
using std::free;
|
||||
using std::malloc;
|
||||
//using std::free;
|
||||
//using std::malloc;
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
using std::memset;
|
||||
#else
|
||||
// In a freestanding environment, these functions may not be available
|
||||
// -- but for now, we assume that they are.
|
||||
extern "C" void *malloc (std::size_t);
|
||||
extern "C" void free(void *);
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
extern "C" void *memset (void *, int, std::size_t);
|
||||
#endif
|
||||
|
||||
@@ -85,13 +87,18 @@ namespace
|
||||
{
|
||||
public:
|
||||
pool();
|
||||
pool(char*, int);
|
||||
|
||||
_GLIBCXX_NODISCARD void *allocate (std::size_t);
|
||||
void free (void *);
|
||||
|
||||
bool in_pool (void *);
|
||||
|
||||
bool mem_static;
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
struct free_entry {
|
||||
std::size_t size;
|
||||
free_entry *next;
|
||||
@@ -121,6 +128,22 @@ namespace
|
||||
arena_size = (EMERGENCY_OBJ_SIZE * EMERGENCY_OBJ_COUNT
|
||||
+ EMERGENCY_OBJ_COUNT * sizeof (__cxa_dependent_exception));
|
||||
arena = (char *)malloc (arena_size);
|
||||
mem_static = false;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
pool::pool(char * storage, int size)
|
||||
{
|
||||
arena_size = size;
|
||||
arena = storage;
|
||||
mem_static = true;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
void pool::init()
|
||||
{
|
||||
if (!arena)
|
||||
{
|
||||
// If the allocation failed go without an emergency pool.
|
||||
@@ -259,7 +282,10 @@ namespace
|
||||
&& p < arena + arena_size);
|
||||
}
|
||||
|
||||
pool emergency_pool;
|
||||
int const emergency_pool_size = EMERGENCY_OBJ_SIZE * EMERGENCY_OBJ_COUNT
|
||||
+ EMERGENCY_OBJ_COUNT * sizeof (__cxa_dependent_exception);
|
||||
char emergency_pool_storage[emergency_pool_size];
|
||||
pool emergency_pool{emergency_pool_storage, emergency_pool_size};
|
||||
}
|
||||
|
||||
namespace __gnu_cxx
|
||||
@@ -267,7 +293,8 @@ namespace __gnu_cxx
|
||||
void
|
||||
__freeres()
|
||||
{
|
||||
if (emergency_pool.arena)
|
||||
// why is this not a destructor?
|
||||
if (emergency_pool.arena and not emergency_pool.mem_static)
|
||||
{
|
||||
::free(emergency_pool.arena);
|
||||
emergency_pool.arena = 0;
|
||||
@@ -281,7 +308,7 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW
|
||||
void *ret;
|
||||
|
||||
thrown_size += sizeof (__cxa_refcounted_exception);
|
||||
ret = malloc (thrown_size);
|
||||
ret = __wrap_malloc (thrown_size);
|
||||
|
||||
if (!ret)
|
||||
ret = emergency_pool.allocate (thrown_size);
|
||||
@@ -312,7 +339,7 @@ __cxxabiv1::__cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW
|
||||
__cxa_dependent_exception *ret;
|
||||
|
||||
ret = static_cast<__cxa_dependent_exception*>
|
||||
(malloc (sizeof (__cxa_dependent_exception)));
|
||||
(__wrap_malloc(sizeof (__cxa_dependent_exception)));
|
||||
|
||||
if (!ret)
|
||||
ret = static_cast <__cxa_dependent_exception*>
|
||||
|
||||
@@ -37,14 +37,16 @@
|
||||
#include <new>
|
||||
|
||||
#if _GLIBCXX_HOSTED
|
||||
using std::free;
|
||||
using std::malloc;
|
||||
//using std::free;
|
||||
//using std::malloc;
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
using std::memset;
|
||||
#else
|
||||
// In a freestanding environment, these functions may not be available
|
||||
// -- but for now, we assume that they are.
|
||||
extern "C" void *malloc (std::size_t);
|
||||
extern "C" void free(void *);
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
extern "C" void *memset (void *, int, std::size_t);
|
||||
#endif
|
||||
|
||||
@@ -120,7 +122,7 @@ namespace
|
||||
// to make this tunable.
|
||||
arena_size = (EMERGENCY_OBJ_SIZE * EMERGENCY_OBJ_COUNT
|
||||
+ EMERGENCY_OBJ_COUNT * sizeof (__cxa_dependent_exception));
|
||||
arena = (char *)malloc (arena_size);
|
||||
arena = (char *)__wrap_malloc (arena_size);
|
||||
if (!arena)
|
||||
{
|
||||
// If the allocation failed go without an emergency pool.
|
||||
@@ -281,7 +283,7 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW
|
||||
void *ret;
|
||||
|
||||
thrown_size += sizeof (__cxa_refcounted_exception);
|
||||
ret = malloc (thrown_size);
|
||||
ret = __wrap_malloc (thrown_size);
|
||||
|
||||
if (!ret)
|
||||
ret = emergency_pool.allocate (thrown_size);
|
||||
@@ -312,7 +314,7 @@ __cxxabiv1::__cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW
|
||||
__cxa_dependent_exception *ret;
|
||||
|
||||
ret = static_cast<__cxa_dependent_exception*>
|
||||
(malloc (sizeof (__cxa_dependent_exception)));
|
||||
(__wrap_malloc (sizeof (__cxa_dependent_exception)));
|
||||
|
||||
if (!ret)
|
||||
ret = static_cast <__cxa_dependent_exception*>
|
||||
|
||||
@@ -37,14 +37,16 @@
|
||||
#include <new>
|
||||
|
||||
#if _GLIBCXX_HOSTED
|
||||
using std::free;
|
||||
using std::malloc;
|
||||
//using std::free;
|
||||
//using std::malloc;
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
using std::memset;
|
||||
#else
|
||||
// In a freestanding environment, these functions may not be available
|
||||
// -- but for now, we assume that they are.
|
||||
extern "C" void *malloc (std::size_t);
|
||||
extern "C" void free(void *);
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
extern "C" void *memset (void *, int, std::size_t);
|
||||
#endif
|
||||
|
||||
@@ -120,7 +122,7 @@ namespace
|
||||
// to make this tunable.
|
||||
arena_size = (EMERGENCY_OBJ_SIZE * EMERGENCY_OBJ_COUNT
|
||||
+ EMERGENCY_OBJ_COUNT * sizeof (__cxa_dependent_exception));
|
||||
arena = (char *)malloc (arena_size);
|
||||
arena = (char *)__wrap_malloc (arena_size);
|
||||
if (!arena)
|
||||
{
|
||||
// If the allocation failed go without an emergency pool.
|
||||
@@ -281,7 +283,7 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW
|
||||
void *ret;
|
||||
|
||||
thrown_size += sizeof (__cxa_refcounted_exception);
|
||||
ret = malloc (thrown_size);
|
||||
ret = __wrap_malloc (thrown_size);
|
||||
|
||||
if (!ret)
|
||||
ret = emergency_pool.allocate (thrown_size);
|
||||
@@ -312,7 +314,7 @@ __cxxabiv1::__cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW
|
||||
__cxa_dependent_exception *ret;
|
||||
|
||||
ret = static_cast<__cxa_dependent_exception*>
|
||||
(malloc (sizeof (__cxa_dependent_exception)));
|
||||
(__wrap_malloc (sizeof (__cxa_dependent_exception)));
|
||||
|
||||
if (!ret)
|
||||
ret = static_cast <__cxa_dependent_exception*>
|
||||
|
||||
@@ -73,14 +73,16 @@
|
||||
// - Tunable glibcxx.eh_pool.obj_size overrides EMERGENCY_OBJ_SIZE.
|
||||
|
||||
#if _GLIBCXX_HOSTED
|
||||
using std::free;
|
||||
using std::malloc;
|
||||
//using std::free;
|
||||
//using std::malloc;
|
||||
using std::memset;
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
#else
|
||||
// In a freestanding environment, these functions may not be available
|
||||
// -- but for now, we assume that they are.
|
||||
extern "C" void *malloc (std::size_t);
|
||||
extern "C" void free(void *);
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
extern "C" void *memset (void *, int, std::size_t);
|
||||
#endif
|
||||
|
||||
@@ -236,7 +238,7 @@ namespace
|
||||
arena_size = buffer_size_in_bytes(obj_count, obj_size);
|
||||
if (arena_size == 0)
|
||||
return;
|
||||
arena = (char *)malloc (arena_size);
|
||||
arena = (char *)__wrap_malloc (arena_size);
|
||||
if (!arena)
|
||||
{
|
||||
// If the allocation failed go without an emergency pool.
|
||||
@@ -399,7 +401,7 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) noexcept
|
||||
{
|
||||
thrown_size += sizeof (__cxa_refcounted_exception);
|
||||
|
||||
void *ret = malloc (thrown_size);
|
||||
void *ret = __wrap_malloc (thrown_size);
|
||||
|
||||
#if USE_POOL
|
||||
if (!ret)
|
||||
@@ -431,7 +433,7 @@ __cxxabiv1::__cxa_free_exception(void *vptr) noexcept
|
||||
extern "C" __cxa_dependent_exception*
|
||||
__cxxabiv1::__cxa_allocate_dependent_exception() noexcept
|
||||
{
|
||||
void *ret = malloc (sizeof (__cxa_dependent_exception));
|
||||
void *ret = __wrap_malloc (sizeof (__cxa_dependent_exception));
|
||||
|
||||
#if USE_POOL
|
||||
if (!ret)
|
||||
|
||||
@@ -73,14 +73,16 @@
|
||||
// - Tunable glibcxx.eh_pool.obj_size overrides EMERGENCY_OBJ_SIZE.
|
||||
|
||||
#if _GLIBCXX_HOSTED
|
||||
using std::free;
|
||||
using std::malloc;
|
||||
//using std::free;
|
||||
//using std::malloc;
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
using std::memset;
|
||||
#else
|
||||
// In a freestanding environment, these functions may not be available
|
||||
// -- but for now, we assume that they are.
|
||||
extern "C" void *malloc (std::size_t);
|
||||
extern "C" void free(void *);
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
extern "C" void *memset (void *, int, std::size_t);
|
||||
#endif
|
||||
|
||||
@@ -236,7 +238,7 @@ namespace
|
||||
arena_size = buffer_size_in_bytes(obj_count, obj_size);
|
||||
if (arena_size == 0)
|
||||
return;
|
||||
arena = (char *)malloc (arena_size);
|
||||
arena = (char *)__wrap_malloc (arena_size);
|
||||
if (!arena)
|
||||
{
|
||||
// If the allocation failed go without an emergency pool.
|
||||
@@ -399,7 +401,7 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) noexcept
|
||||
{
|
||||
thrown_size += sizeof (__cxa_refcounted_exception);
|
||||
|
||||
void *ret = malloc (thrown_size);
|
||||
void *ret = __wrap_malloc (thrown_size);
|
||||
|
||||
#if USE_POOL
|
||||
if (!ret)
|
||||
@@ -431,7 +433,7 @@ __cxxabiv1::__cxa_free_exception(void *vptr) noexcept
|
||||
extern "C" __cxa_dependent_exception*
|
||||
__cxxabiv1::__cxa_allocate_dependent_exception() noexcept
|
||||
{
|
||||
void *ret = malloc (sizeof (__cxa_dependent_exception));
|
||||
void *ret = __wrap_malloc (sizeof (__cxa_dependent_exception));
|
||||
|
||||
#if USE_POOL
|
||||
if (!ret)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*- Allocate exception objects.
|
||||
// Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2001-2024 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of GCC.
|
||||
//
|
||||
@@ -73,14 +73,16 @@
|
||||
// - Tunable glibcxx.eh_pool.obj_size overrides EMERGENCY_OBJ_SIZE.
|
||||
|
||||
#if _GLIBCXX_HOSTED
|
||||
using std::free;
|
||||
using std::malloc;
|
||||
//using std::free;
|
||||
//using std::malloc;
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
using std::memset;
|
||||
#else
|
||||
// In a freestanding environment, these functions may not be available
|
||||
// -- but for now, we assume that they are.
|
||||
extern "C" void *malloc (std::size_t);
|
||||
extern "C" void free(void *);
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
extern "C" void *memset (void *, int, std::size_t);
|
||||
#endif
|
||||
|
||||
@@ -236,7 +238,7 @@ namespace
|
||||
arena_size = buffer_size_in_bytes(obj_count, obj_size);
|
||||
if (arena_size == 0)
|
||||
return;
|
||||
arena = (char *)malloc (arena_size);
|
||||
arena = (char *)__wrap_malloc (arena_size);
|
||||
if (!arena)
|
||||
{
|
||||
// If the allocation failed go without an emergency pool.
|
||||
@@ -399,7 +401,7 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) noexcept
|
||||
{
|
||||
thrown_size += sizeof (__cxa_refcounted_exception);
|
||||
|
||||
void *ret = malloc (thrown_size);
|
||||
void *ret = __wrap_malloc (thrown_size);
|
||||
|
||||
#if USE_POOL
|
||||
if (!ret)
|
||||
@@ -431,7 +433,7 @@ __cxxabiv1::__cxa_free_exception(void *vptr) noexcept
|
||||
extern "C" __cxa_dependent_exception*
|
||||
__cxxabiv1::__cxa_allocate_dependent_exception() noexcept
|
||||
{
|
||||
void *ret = malloc (sizeof (__cxa_dependent_exception));
|
||||
void *ret = __wrap_malloc (sizeof (__cxa_dependent_exception));
|
||||
|
||||
#if USE_POOL
|
||||
if (!ret)
|
||||
|
||||
@@ -37,14 +37,16 @@
|
||||
#include <new>
|
||||
|
||||
#if _GLIBCXX_HOSTED
|
||||
using std::free;
|
||||
using std::malloc;
|
||||
//using std::free;
|
||||
//using std::malloc;
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
using std::memset;
|
||||
#else
|
||||
// In a freestanding environment, these functions may not be available
|
||||
// -- but for now, we assume that they are.
|
||||
extern "C" void *malloc (std::size_t);
|
||||
extern "C" void free(void *);
|
||||
extern "C" void *__wrap_malloc (std::size_t);
|
||||
extern "C" void __wrap_free(void *);
|
||||
extern "C" void *memset (void *, int, std::size_t);
|
||||
#endif
|
||||
|
||||
@@ -120,7 +122,7 @@ namespace
|
||||
// to make this tunable.
|
||||
arena_size = (EMERGENCY_OBJ_SIZE * EMERGENCY_OBJ_COUNT
|
||||
+ EMERGENCY_OBJ_COUNT * sizeof (__cxa_dependent_exception));
|
||||
arena = (char *)malloc (arena_size);
|
||||
arena = (char *)__wrap_malloc (arena_size);
|
||||
if (!arena)
|
||||
{
|
||||
// If the allocation failed go without an emergency pool.
|
||||
@@ -281,7 +283,7 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW
|
||||
void *ret;
|
||||
|
||||
thrown_size += sizeof (__cxa_refcounted_exception);
|
||||
ret = malloc (thrown_size);
|
||||
ret = __wrap_malloc (thrown_size);
|
||||
|
||||
if (!ret)
|
||||
ret = emergency_pool.allocate (thrown_size);
|
||||
@@ -312,7 +314,7 @@ __cxxabiv1::__cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW
|
||||
__cxa_dependent_exception *ret;
|
||||
|
||||
ret = static_cast<__cxa_dependent_exception*>
|
||||
(malloc (sizeof (__cxa_dependent_exception)));
|
||||
(__wrap_malloc (sizeof (__cxa_dependent_exception)));
|
||||
|
||||
if (!ret)
|
||||
ret = static_cast <__cxa_dependent_exception*>
|
||||
|
||||
@@ -994,6 +994,8 @@ static void *realloc(void *ptr, size_t size)
|
||||
|
||||
} // namespace umalloc
|
||||
|
||||
L4_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Standard-compliant malloc implementation.
|
||||
*
|
||||
@@ -1001,7 +1003,7 @@ static void *realloc(void *ptr, size_t size)
|
||||
*
|
||||
* \return Valid allocated memory or nullptr if the allocation failed.
|
||||
*/
|
||||
void *malloc(size_t size) noexcept
|
||||
void *__wrap_malloc(size_t size) noexcept
|
||||
{
|
||||
auto ptr = umalloc::alloc(size);
|
||||
if (!ptr)
|
||||
@@ -1018,7 +1020,7 @@ void *malloc(size_t size) noexcept
|
||||
*
|
||||
* \return Valid allocated memory or nullptr if the allocation failed.
|
||||
*/
|
||||
void *aligned_alloc(size_t alignment, size_t size) noexcept
|
||||
void *__wrap_aligned_alloc(size_t alignment, size_t size) noexcept
|
||||
{
|
||||
auto ptr = umalloc::alloc(size, alignment);
|
||||
if (!ptr)
|
||||
@@ -1032,7 +1034,7 @@ void *aligned_alloc(size_t alignment, size_t size) noexcept
|
||||
*
|
||||
* \param ptr Previously allocated valid memory.
|
||||
*/
|
||||
void free(void *ptr) noexcept
|
||||
void __wrap_free(void *ptr) noexcept
|
||||
{
|
||||
if (ptr)
|
||||
umalloc::dealloc(ptr);
|
||||
@@ -1046,7 +1048,7 @@ void free(void *ptr) noexcept
|
||||
*
|
||||
* \return Valid allocated memory or nullptr if the allocation failed.
|
||||
*/
|
||||
void *calloc(size_t nmemb, size_t size) noexcept
|
||||
void *__wrap_calloc(size_t nmemb, size_t size) noexcept
|
||||
{
|
||||
// Avoid multiplication overflow.
|
||||
if ((size > 0) && (nmemb > std::numeric_limits<typeof(nmemb)>::max() / size))
|
||||
@@ -1073,7 +1075,7 @@ void *calloc(size_t nmemb, size_t size) noexcept
|
||||
* \return Valid reallocated memory or nullptr if the reallocation failed.
|
||||
* (in which case the previously allocated memory is not touched).
|
||||
*/
|
||||
void *realloc(void *ptr, size_t size) noexcept
|
||||
void *__wrap_realloc(void *ptr, size_t size) noexcept
|
||||
{
|
||||
if (!ptr)
|
||||
return malloc(size);
|
||||
@@ -1084,3 +1086,5 @@ void *realloc(void *ptr, size_t size) noexcept
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
L4_END_DECLS
|
||||
|
||||
@@ -4,7 +4,7 @@ L4DIR ?= $(PKGDIR)/../../..
|
||||
TARGET = lua
|
||||
SRC_C = lua.c
|
||||
REQUIRES_LIBS = lua libc_support_misc libc_be_fs_noop libc_be_sig
|
||||
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
vpath %.c $(PKGDIR)/lib/contrib/src
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -10,6 +10,8 @@ $(GENERAL_D_LOC): $(PKGDIR)/lib/build/Makefile
|
||||
|
||||
PKGNAME_DIRNAME := lua-c++
|
||||
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
# Difference to other version
|
||||
|
||||
# WARNINGS EXCEPTION: CFLAGS is used here for C++ files (instead of the usual
|
||||
|
||||
@@ -25,6 +25,7 @@ CAN_PIE_arm := y
|
||||
CAN_PIE_arm64 := y
|
||||
BID_CAN_PIE = $(CAN_PIE_$(ARCH))
|
||||
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc --wrap=aligned_alloc --wrap=calloc
|
||||
REQUIRES_LIBS := libkproxy libloader libsigma0 \
|
||||
cxx_io cxx_libc_io libsupc++_minimal \
|
||||
libc_minimal libc_minimal_l4re libumalloc
|
||||
|
||||
@@ -6,4 +6,6 @@ SRC_CC = ned-prompt.cc
|
||||
REQUIRES_LIBS := readline
|
||||
DEPENDS_PKGS := readline
|
||||
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -14,5 +14,6 @@ SRC_CC += lua_sleep.cc
|
||||
REQUIRES_LIBS := libloader lua++ libc_support_misc cxx_libc_io cxx_io
|
||||
|
||||
DEFAULT_HEAP_SIZE := 0x20000
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -4,5 +4,6 @@ L4DIR ?= $(PKGDIR)/../..
|
||||
TARGET = backtracer
|
||||
SRC_CC = backtracer.cc
|
||||
REQUIRES_LIBS = stdlibs libunwind libstdc++
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -10,5 +10,6 @@ LDFLAGS +=
|
||||
#CPPFLAGS += -fPIC
|
||||
|
||||
REQUIRES_LIBS := libloader libkproxy cxx_libc_io cxx_io
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
provides: libmag mag-input-libinput mag-input-event mag-client_fb mag-mag_client mag-session_manager
|
||||
requires: l4re libc stdlibs-sh input l4util mag-gfx libstdc++
|
||||
lua++
|
||||
lua++ libc_be_mem
|
||||
Maintainer: warg@os.inf.tu-dresden.de
|
||||
|
||||
@@ -15,7 +15,7 @@ STATIC_PLUGINS += mag-input-event
|
||||
STATIC_PLUGINS += mag-client_fb
|
||||
STATIC_PLUGINS += mag-mag_client
|
||||
|
||||
REQUIRES_LIBS:= libsupc++ libdl mag-gfx lua++ cxx_libc_io cxx_io
|
||||
REQUIRES_LIBS:= libsupc++ libdl mag-gfx lua++ cxx_libc_io cxx_io libc_be_mem libstdc++
|
||||
REQUIRES_LIBS += $(STATIC_PLUGINS)
|
||||
#LDFLAGS += --export-dynamic
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
provides: rtc rtc_libc_be
|
||||
requires: stdlibs libio cxx_libc_io cxx_io libstdc++
|
||||
requires: stdlibs libio cxx_libc_io cxx_io libstdc++ libc_be_mem
|
||||
optional: drivers-frst i2c-server
|
||||
Maintainer: adam.lackorzynski@kernkonzept.com
|
||||
|
||||
@@ -9,6 +9,6 @@ SRC_CC_arm64-l4f = pl031.cc
|
||||
SRC_CC = main.cc
|
||||
SRC_CC-$(CONFIG_RTC_DS3231) += ds3231.cc
|
||||
SRC_CC-$(CONFIG_RTC_PCF85063A) += pcf85063a.cc
|
||||
REQUIRES_LIBS = libio cxx_libc_io cxx_io libstdc++
|
||||
REQUIRES_LIBS = libio cxx_libc_io cxx_io libc_be_mem libstdc++
|
||||
|
||||
include $(L4DIR)/mk/prog.mk
|
||||
|
||||
@@ -5,6 +5,7 @@ TARGET = l4vio_switch
|
||||
|
||||
REQUIRES_LIBS = libstdc++ l4virtio
|
||||
REQUIRES_LIBS-$(CONFIG_VNS_IXL) += ixl
|
||||
LDFLAGS += --wrap=malloc --wrap=free --wrap=realloc
|
||||
|
||||
SRC_CC-$(CONFIG_VNS_PORT_FILTER) += filter.cc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user