]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/stubs.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1997 by Apple Computer, Inc., all rights reserved
27 * Copyright (c) 1993 NeXT Computer, Inc.
31 #include <sys/param.h>
32 #include <sys/systm.h>
34 #include <sys/ioctl.h>
39 #include <kern/thread.h>
40 #include <kern/thread_act.h>
41 #include <kern/task.h>
42 #include <vm/vm_map.h>
46 * copy a null terminated string from one point to another in
47 * the kernel address space.
48 * - no access checks are performed.
49 * - if the end of string isn't found before
50 * maxlen bytes are copied, return ENAMETOOLONG,
51 * indicating an incomplete copy.
52 * - otherwise, return 0, indicating success.
53 * the number of bytes copied is always returned in lencopied.
55 /* from ppc/fault_copy.c -Titan1T4 VERSION */
57 copystr(vfrom
, vto
, maxlen
, lencopied
)
58 register void * vfrom
, *vto
;
59 size_t maxlen
, *lencopied
;
67 for (l
= 0; l
< maxlen
; l
++)
68 if ((*to
++ = *from
++) == '\0') {
78 int copywithin(src
, dst
, count
)
86 struct unix_syscallargs
{
89 int arg1
, arg2
,arg3
,arg4
,arg5
,arg6
,arg7
;
92 set_bsduthreadargs(thread_t th
, void * pcb
, struct unix_syscallargs
* sarg
)
96 ut
= get_bsdthread_info(th
);
97 ut
->uu_ar0
= (int *)pcb
;
101 ut
->uu_arg
[0] = sarg
->arg1
;
102 ut
->uu_arg
[1] = sarg
->arg2
;
103 ut
->uu_arg
[2] = sarg
->arg3
;
104 ut
->uu_arg
[3] = sarg
->arg4
;
105 ut
->uu_arg
[4] = sarg
->arg5
;
106 ut
->uu_arg
[5] = sarg
->arg6
;
107 ut
->uu_arg
[7] = sarg
->arg7
;
111 ut
->uu_arg
[0] = sarg
->r3
;
112 ut
->uu_arg
[1] = sarg
->arg1
;
113 ut
->uu_arg
[2] = sarg
->arg2
;
114 ut
->uu_arg
[3] = sarg
->arg3
;
115 ut
->uu_arg
[4] = sarg
->arg4
;
116 ut
->uu_arg
[5] = sarg
->arg5
;
117 ut
->uu_arg
[6] = sarg
->arg6
;
118 ut
->uu_arg
[7] = sarg
->arg7
;
125 get_bsduthreadarg(thread_t th
)
128 ut
= get_bsdthread_info(th
);
129 return((void *)(ut
->uu_arg
));
133 get_bsduthreadrval(thread_act_t th
)
136 ut
= get_bsdthread_info(th
);
137 return(&ut
->uu_rval
[0]);