diff --git a/repos/dde_linux/src/include/lx_emul/impl/slab.h b/repos/dde_linux/src/include/lx_emul/impl/slab.h
index 6e85ceee0d..b0ee870e3a 100644
--- a/repos/dde_linux/src/include/lx_emul/impl/slab.h
+++ b/repos/dde_linux/src/include/lx_emul/impl/slab.h
@@ -165,7 +165,13 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align
* XXX SLAB_LX_DMA is never used anywhere else, remove it?
*/
enum { SLAB_LX_DMA = 0x80000000ul, };
- return new (Genode::env()->heap()) kmem_cache(size, flags & SLAB_LX_DMA, ctor);
+ return new (Lx::Malloc::mem()) kmem_cache(size, flags & SLAB_LX_DMA, ctor);
+}
+
+
+void kmem_cache_destroy(struct kmem_cache *cache)
+{
+ destroy(Lx::Malloc::mem(), cache);
}
diff --git a/repos/dde_linux/src/include/lx_kit/env.h b/repos/dde_linux/src/include/lx_kit/env.h
new file mode 100644
index 0000000000..0f764ada34
--- /dev/null
+++ b/repos/dde_linux/src/include/lx_kit/env.h
@@ -0,0 +1,47 @@
+/**
+ * \brief Helper class to make the Genode Env globally available
+ * \author Sebastian Sumpf
+ * \date 2016-06-21
+ */
+
+/*
+ * Copyright (C) 2016 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#ifndef _LX_KIT__ENV_H_
+#define _LX_KIT__ENV_H_
+
+#include
+#include
+#include
+#include
+
+namespace Lx_kit {
+ class Env;
+
+ Env &env();
+
+ void construct_env(Genode::Env &env);
+}
+
+class Lx_kit::Env
+{
+ private:
+
+ Genode::Env &_env;
+ Genode::Heap _heap { _env.ram(), _env.rm() };
+ Genode::Attached_rom_dataspace _config { _env, "config" };
+
+ public:
+
+ Env(Genode::Env &env) : _env(env) { }
+
+ Genode::Env &env() { return _env; }
+ Genode::Heap &heap() { return _heap; }
+ Genode::Attached_rom_dataspace &config_rom() { return _config; }
+};
+
+#endif /* _LX_KIT__ENV_H_ */
diff --git a/repos/dde_linux/src/include/lx_kit/malloc.h b/repos/dde_linux/src/include/lx_kit/malloc.h
index 1611d9d384..818066fdaf 100644
--- a/repos/dde_linux/src/include/lx_kit/malloc.h
+++ b/repos/dde_linux/src/include/lx_kit/malloc.h
@@ -28,7 +28,7 @@ namespace Lx {
}
-class Lx::Malloc
+class Lx::Malloc : public Genode::Allocator
{
public:
@@ -56,11 +56,23 @@ class Lx::Malloc
*/
virtual bool inside(addr_t const addr) const = 0;
+ /**
+ * Genode alllocator interface
+ */
+ bool need_size_for_free() const override { return false; }
+
+ size_t overhead(size_t size) const override { return 0; }
+
+ bool alloc(size_t size, void **out_addr) override
+ {
+ *out_addr = alloc(size);
+ return *out_addr ? true : false;
+ }
+
+ void free(void *addr, size_t size) override { free(addr); }
+
static Malloc &mem();
static Malloc &dma();
};
-
-void *operator new (Genode::size_t, Lx::Malloc &);
-
#endif /* _LX_KIT__MALLOC_H_ */
diff --git a/repos/dde_linux/src/lx_kit/env.cc b/repos/dde_linux/src/lx_kit/env.cc
new file mode 100644
index 0000000000..df3ef6ac95
--- /dev/null
+++ b/repos/dde_linux/src/lx_kit/env.cc
@@ -0,0 +1,31 @@
+/**
+ * \brief Usb::Env initialization
+ * \author Sebastian Sumpf
+ * \date 2016-06-23
+ */
+
+/*
+ * Copyright (C) 2016 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#include
+
+/*
+ * Lx_kit enviroment instance
+ */
+static Genode::Lazy_volatile_object _env;
+
+
+Lx_kit::Env &Lx_kit::env()
+{
+ return *_env;
+}
+
+
+void Lx_kit::construct_env(Genode::Env &env)
+{
+ _env.construct(env);
+}
diff --git a/repos/dde_linux/src/lx_kit/malloc.cc b/repos/dde_linux/src/lx_kit/malloc.cc
index a4b540b857..9dab438e89 100644
--- a/repos/dde_linux/src/lx_kit/malloc.cc
+++ b/repos/dde_linux/src/lx_kit/malloc.cc
@@ -382,7 +382,3 @@ Lx::Malloc &Lx::Malloc::mem() {
Lx::Malloc &Lx::Malloc::dma() {
return Lx_kit::Malloc::dma(); }
-/**
- * Placement new for Malloc allocator
- */
-void *operator new (Genode::size_t s, Lx::Malloc &a) { return a.alloc(s); }