1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup rtems_bsd_rtems |
---|
5 | * |
---|
6 | * @brief TODO. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * embedded brains GmbH |
---|
13 | * Obere Lagerstr. 30 |
---|
14 | * 82178 Puchheim |
---|
15 | * Germany |
---|
16 | * <rtems@embedded-brains.de> |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.com/license/LICENSE. |
---|
21 | */ |
---|
22 | |
---|
23 | #include <rtems/freebsd/machine/rtems-bsd-config.h> |
---|
24 | #include <rtems/score/states.h> |
---|
25 | #include <rtems/score/thread.h> |
---|
26 | #include <rtems/score/threadq.h> |
---|
27 | |
---|
28 | #include <rtems/freebsd/sys/types.h> |
---|
29 | #include <rtems/freebsd/sys/systm.h> |
---|
30 | #include <rtems/freebsd/sys/malloc.h> |
---|
31 | #include <rtems/freebsd/sys/uio.h> |
---|
32 | |
---|
33 | int |
---|
34 | copyout(const void *kaddr, void *udaddr, size_t len) |
---|
35 | { |
---|
36 | bcopy(kaddr, udaddr, len); |
---|
37 | return (0); |
---|
38 | } |
---|
39 | |
---|
40 | int |
---|
41 | copyin(const void *udaddr, void *kaddr, size_t len) |
---|
42 | { |
---|
43 | bcopy(udaddr, kaddr, len); |
---|
44 | return (0); |
---|
45 | } |
---|
46 | |
---|
47 | int |
---|
48 | copyiniov(struct iovec *iovp, u_int iovcnt, struct iovec **iov, int error) |
---|
49 | { |
---|
50 | u_int iovlen; |
---|
51 | |
---|
52 | *iov = NULL; |
---|
53 | if (iovcnt > UIO_MAXIOV) |
---|
54 | return (error); |
---|
55 | iovlen = iovcnt * sizeof (struct iovec); |
---|
56 | *iov = malloc(iovlen, M_IOV, M_WAITOK); |
---|
57 | error = copyin(iovp, *iov, iovlen); |
---|
58 | if (error) { |
---|
59 | free(*iov, M_IOV); |
---|
60 | *iov = NULL; |
---|
61 | } |
---|
62 | return (error); |
---|
63 | } |
---|
64 | |
---|
65 | void |
---|
66 | critical_enter(void) |
---|
67 | { |
---|
68 | _Thread_Disable_dispatch(); |
---|
69 | } |
---|
70 | |
---|
71 | void |
---|
72 | critical_exit(void) |
---|
73 | { |
---|
74 | _Thread_Enable_dispatch(); |
---|
75 | } |
---|