]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/dde/ddekit/src/malloc.cc
Update
[l4.git] / l4 / pkg / dde / ddekit / src / malloc.cc
index 3f836730241ec2aff7f6dee6561eb88da4c32690..15966b4dfb252b3b68d30b5abe3d2e732c3a2096 100644 (file)
@@ -1,8 +1,5 @@
 /*
  * \brief   Simple allocator implementation
- * \author  Christian Helmuth
- * \author  Bjoern Doebel
- * \date    2008-08-26
  *
  * This simple allocator provides malloc() and free() using dm_mem dataspaces
  * as backing store. The actual list-based allocator implementation is from
  * ddekit_large_malloc and ddekit_slab_*() should be used. The blocks
  * allocated via this allocator CANNOT be used for DMA or other device
  * operations, i.e., there exists no virt->phys mapping.
+ */
+
+/*
+ * This file is part of DDEKit.
+ *
+ * (c) 2006-2012 Bjoern Doebel <doebel@os.inf.tu-dresden.de>
+ *               Christian Helmuth <ch12@os.inf.tu-dresden.de>
+ *               Thomas Friebel <tf13@os.inf.tu-dresden.de>
+ *     economic rights: Technische Universitaet Dresden (Germany)
  *
- * (c) 2006-2008 Technische Universität Dresden
- * This file is part of TUD:OS, which is distributed under the terms of the
- * GNU General Public License 2. Please see the COPYING file for details.
+ * This file is part of TUD:OS and distributed under the terms of the
+ * GNU General Public License 2.
+ * Please see the COPYING-GPL-2 file for details.
  */
 
 /*
@@ -79,7 +85,7 @@ EXTERN_C void * ddekit_simple_malloc(unsigned size)
                if (err < 0)
                        goto err_out;
 
-               err = L4Re::Env::env()->rm()->attach(&res, ds_size, L4Re::Rm::Search_addr, ds, 0);
+               err = L4Re::Env::env()->rm()->attach(&res, ds_size, L4Re::Rm::Search_addr, L4::Ipc::make_cap_rw(ds), 0);
                if (err < 0)
                        goto err_out;
 
@@ -97,6 +103,8 @@ EXTERN_C void * ddekit_simple_malloc(unsigned size)
        }
 
 err_out:
+        // FIXME: goto is error prone in C++
+        // FIXME: missing nearly all free operations here
        pthread_mutex_unlock(&malloc_mtx);
 
        return p;