diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2012-03-07 16:14:13 -0600 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2012-03-07 16:14:13 -0600 |
commit | cbffdb7fdc50cbf0175fd5cb6ae32f6f115d6035 (patch) | |
tree | 2c5aa2ff0a7e9a24df6e098860675a8d3ff9e24e /rtemsbsd/src/rtems-bsd-support.c | |
parent | Add rmlock - almost links (diff) | |
download | rtems-libbsd-cbffdb7fdc50cbf0175fd5cb6ae32f6f115d6035.tar.bz2 |
Separate RTEMS Specific Files from Those Direct from FreeBSD
Diffstat (limited to 'rtemsbsd/src/rtems-bsd-support.c')
-rw-r--r-- | rtemsbsd/src/rtems-bsd-support.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/rtemsbsd/src/rtems-bsd-support.c b/rtemsbsd/src/rtems-bsd-support.c new file mode 100644 index 00000000..461078e9 --- /dev/null +++ b/rtemsbsd/src/rtems-bsd-support.c @@ -0,0 +1,75 @@ +/** + * @file + * + * @ingroup rtems_bsd_rtems + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <rtems/freebsd/machine/rtems-bsd-config.h> +#include <rtems/score/states.h> +#include <rtems/score/thread.h> +#include <rtems/score/threadq.h> + +#include <rtems/freebsd/sys/types.h> +#include <rtems/freebsd/sys/systm.h> +#include <rtems/freebsd/sys/malloc.h> +#include <rtems/freebsd/sys/uio.h> + +int +copyout(const void *kaddr, void *udaddr, size_t len) +{ + bcopy(kaddr, udaddr, len); + return (0); +} + +int +copyin(const void *udaddr, void *kaddr, size_t len) +{ + bcopy(udaddr, kaddr, len); + return (0); +} + +int +copyiniov(struct iovec *iovp, u_int iovcnt, struct iovec **iov, int error) +{ + u_int iovlen; + + *iov = NULL; + if (iovcnt > UIO_MAXIOV) + return (error); + iovlen = iovcnt * sizeof (struct iovec); + *iov = malloc(iovlen, M_IOV, M_WAITOK); + error = copyin(iovp, *iov, iovlen); + if (error) { + free(*iov, M_IOV); + *iov = NULL; + } + return (error); +} + +void +critical_enter(void) +{ + _Thread_Disable_dispatch(); +} + +void +critical_exit(void) +{ + _Thread_Enable_dispatch(); +} |