Changeset 11fa83a in mainline


Ignore:
Timestamp:
2006-04-26T16:43:44Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
07b3d93f
Parents:
3214a20
Message:

Add userspace support for SYS_AS_AREA_ACCEPT and SYS_AS_AREA_SEND syscalls.

Location:
libc
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • libc/Makefile

    r3214a20 r11fa83a  
    4545        generic/libc.c \
    4646        generic/ddi.c \
    47         generic/mmap.c \
     47        generic/as.c \
    4848        generic/string.c \
    4949        generic/thread.c \
  • libc/generic/as.c

    r3214a20 r11fa83a  
    2929#include <libc.h>
    3030#include <unistd.h>
     31#include <kernel/mm/as_arg.h>
     32#include <task.h>
    3133
    3234/** Create address space area.
     
    5456{
    5557        return (void *) __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
     58}
     59
     60/** Prepare to accept address space area.
     61 *
     62 * @param id Task ID of the donor task.
     63 * @param base Destination address for the new address space area.
     64 * @param size Size of the new address space area.
     65 * @param flags Flags of the area TASK is willing to accept.
     66 *
     67 * @return 0 on success or a code from errno.h.
     68 */
     69int as_area_accept(task_id_t id, void *base, size_t size, int flags)
     70{
     71        as_area_acptsnd_arg_t arg;
     72       
     73        arg.task_id = id;
     74        arg.base = base;
     75        arg.size = size;
     76        arg.flags = flags;
     77       
     78        return __SYSCALL1(SYS_AS_AREA_ACCEPT, (__native) &arg);
     79}
     80
     81/** Send address space area to another task.
     82 *
     83 * @param id Task ID of the acceptor task.
     84 * @param base Source address of the existing address space area.
     85 *
     86 * @return 0 on success or a code from errno.h.
     87 */
     88int as_area_send(task_id_t id, void *base)
     89{
     90        as_area_acptsnd_arg_t arg;
     91       
     92        arg.task_id = id;
     93        arg.base = base;
     94        arg.size = 0;
     95        arg.flags = 0;
     96       
     97        return __SYSCALL1(SYS_AS_AREA_SEND, (__native) &arg);
    5698}
    5799
  • libc/include/unistd.h

    r3214a20 r11fa83a  
    3232#include <types.h>
    3333#include <arch/mm/page.h>
     34#include <task.h>
    3435
    3536#define NULL 0
     
    3839extern ssize_t write(int fd, const void * buf, size_t count);
    3940extern void _exit(int status);
    40 void *as_area_create(void *address, size_t size, int flags);
    41 void *as_area_resize(void *address, size_t size, int flags);
     41extern void *as_area_create(void *address, size_t size, int flags);
     42extern void *as_area_resize(void *address, size_t size, int flags);
     43extern int as_area_accept(task_id_t id, void *base, size_t size, int flags);
     44extern int as_area_send(task_id_t id, void *base);
    4245void *sbrk(ssize_t incr);
    4346
Note: See TracChangeset for help on using the changeset viewer.