Module: xenomai-head
Branch: master
Commit: 2ceeac4a479bd43fbe79188cda4ff5e25c4ca736
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=2ceeac4a479bd43fbe79188cda4ff5e25c4ca736

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Jul 22 11:15:35 2009 +0200

native: alloc host memory for buffers

---

 ksrc/skins/native/buffer.c  |   10 ++++------
 ksrc/skins/native/syscall.c |    4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/ksrc/skins/native/buffer.c b/ksrc/skins/native/buffer.c
index 14d6a78..7d3c235 100644
--- a/ksrc/skins/native/buffer.c
+++ b/ksrc/skins/native/buffer.c
@@ -182,8 +182,7 @@ static xnpnode_t __buffer_pnode = {
  * This service can be called from:
  *
  * - Kernel module initialization/cleanup code
- * - Kernel-based task
- * - User-space task
+ * - User-space task (switches to secondary mode)
  *
  * Rescheduling: possible.
  */
@@ -199,7 +198,7 @@ int rt_buffer_create(RT_BUFFER *bf, const char *name, 
size_t bufsz, int mode)
        if (bufsz == 0)
                return -EINVAL;
 
-       bf->bufmem = xnmalloc(bufsz);
+       bf->bufmem = xnarch_alloc_host_mem(bufsz);
        if (bf->bufmem == NULL)
                return -ENOMEM;
 
@@ -270,8 +269,7 @@ int rt_buffer_create(RT_BUFFER *bf, const char *name, 
size_t bufsz, int mode)
  * This service can be called from:
  *
  * - Kernel module initialization/cleanup code
- * - Kernel-based task
- * - User-space task
+ * - User-space task (switches to secondary mode)
  *
  * Rescheduling: possible.
  */
@@ -292,7 +290,7 @@ int rt_buffer_delete(RT_BUFFER *bf)
                goto unlock_and_exit;
        }
 
-       xnfree(bf->bufmem);
+       xnarch_free_host_mem(bf->bufmem, bf->bufsz);
        removeq(bf->rqueue, &bf->rlink);
        resched = xnsynch_destroy(&bf->isynch_base) == XNSYNCH_RESCHED;
        resched += xnsynch_destroy(&bf->osynch_base) == XNSYNCH_RESCHED;
diff --git a/ksrc/skins/native/syscall.c b/ksrc/skins/native/syscall.c
index 850334f..71cfad8 100644
--- a/ksrc/skins/native/syscall.c
+++ b/ksrc/skins/native/syscall.c
@@ -4120,9 +4120,9 @@ static xnsysent_t __systab[] = {
        [__native_io_put_region] = {&__rt_io_put_region, __xn_exec_lostage},
        [__native_unimp_92] = {&__rt_call_not_available, __xn_exec_any},
        [__native_unimp_93] = {&__rt_call_not_available, __xn_exec_any},
-       [__native_buffer_create] = {&__rt_buffer_create, __xn_exec_any},
+       [__native_buffer_create] = {&__rt_buffer_create, __xn_exec_lostage},
        [__native_buffer_bind] = {&__rt_buffer_bind, __xn_exec_conforming},
-       [__native_buffer_delete] = {&__rt_buffer_delete, __xn_exec_any},
+       [__native_buffer_delete] = {&__rt_buffer_delete, __xn_exec_lostage},
        [__native_buffer_read] = {&__rt_buffer_read, __xn_exec_conforming},
        [__native_buffer_write] = {&__rt_buffer_write, __xn_exec_conforming},
        [__native_buffer_clear] = {&__rt_buffer_clear, __xn_exec_any},


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to