]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/stubs.c
xnu-792.6.56.tar.gz
[apple/xnu.git] / bsd / dev / ppc / stubs.c
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * Copyright (c) 1997 by Apple Computer, Inc., all rights reserved
25 * Copyright (c) 1993 NeXT Computer, Inc.
26 *
27 */
28
29 #include <sys/param.h>
30 #include <sys/systm.h>
31 #include <sys/ioctl.h>
32 #include <sys/tty.h>
33 #include <sys/conf.h>
34 #include <sys/proc.h>
35 #include <sys/user.h>
36 #include <kern/thread.h>
37 #include <kern/task.h>
38 #include <vm/vm_map.h>
39
40
41 /*
42 * copy a null terminated string from one point to another in
43 * the kernel address space.
44 * - no access checks are performed.
45 * - if the end of string isn't found before
46 * maxlen bytes are copied, return ENAMETOOLONG,
47 * indicating an incomplete copy.
48 * - otherwise, return 0, indicating success.
49 * the number of bytes copied is always returned in lencopied.
50 */
51 /* from ppc/fault_copy.c -Titan1T4 VERSION */
52 int
53 copystr(const void *vfrom, void *vto, size_t maxlen, size_t *lencopied)
54 {
55 register unsigned l;
56 caddr_t from, to;
57
58 from = vfrom;
59 to = vto;
60 for (l = 0; l < maxlen; l++)
61 if ((*to++ = *from++) == '\0') {
62 if (lencopied)
63 *lencopied = l + 1;
64 return 0;
65 }
66 if (lencopied)
67 *lencopied = maxlen;
68 return ENAMETOOLONG;
69 }
70
71 int copywithin(src, dst, count)
72 void * src, *dst;
73 size_t count;
74 {
75 bcopy(src,dst,count);
76 return 0;
77 }
78
79 void *
80 get_bsduthreadarg(thread_t th)
81 {
82 struct uthread *ut;
83 ut = get_bsdthread_info(th);
84 return((void *)(ut->uu_arg));
85 }
86
87 int *
88 get_bsduthreadrval(thread_t th)
89 {
90 struct uthread *ut;
91 ut = get_bsdthread_info(th);
92 return(&ut->uu_rval[0]);
93 }
94