]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/i386/stubs.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1997 by Apple Computer, Inc., all rights reserved
24 * Copyright (c) 1993 NeXT Computer, Inc.
28 #include <sys/param.h>
29 #include <sys/systm.h>
31 #include <sys/ioctl.h>
36 #include <kern/task.h>
37 #include <kern/thread.h>
38 #include <kern/thread_act.h>
39 #include <vm/vm_map.h>
43 * copy a null terminated string from the kernel address space into
44 * the user address space.
45 * - if the user is denied write access, return EFAULT.
46 * - if the end of string isn't found before
47 * maxlen bytes are copied, return ENAMETOOLONG,
48 * indicating an incomplete copy.
49 * - otherwise, return 0, indicating success.
50 * the number of bytes copied is always returned in lencopied.
53 copyoutstr(from
, to
, maxlen
, lencopied
)
55 size_t maxlen
, *lencopied
;
59 slen
= strlen(from
) + 1;
61 len
= min(maxlen
,slen
);
62 if (copyout(from
, to
, len
))
71 * copy a null terminated string from one point to another in
72 * the kernel address space.
73 * - no access checks are performed.
74 * - if the end of string isn't found before
75 * maxlen bytes are copied, return ENAMETOOLONG,
76 * indicating an incomplete copy.
77 * - otherwise, return 0, indicating success.
78 * the number of bytes copied is always returned in lencopied.
80 /* from ppc/fault_copy.c -Titan1T4 VERSION */
82 copystr(vfrom
, vto
, maxlen
, lencopied
)
83 register void * vfrom
, *vto
;
84 size_t maxlen
, *lencopied
;
92 for (l
= 0; l
< maxlen
; l
++)
93 if ((*to
++ = *from
++) == '\0') {
103 int copywithin(src
, dst
, count
)
107 bcopy(src
,dst
,count
);
111 cpu_number() {return(0);}
113 set_bsduthreadargs(thread_t th
, void * pcb
, void *ignored_arg
)
117 ut
= get_bsdthread_info(th
);
118 ut
->uu_ar0
= (int *)pcb
;
124 get_bsduthreadarg(thread_t th
)
127 ut
= get_bsdthread_info(th
);
128 return((void *)(ut
->uu_arg
));
132 get_bsduthreadrval(thread_act_t th
)
135 ut
= get_bsdthread_info(th
);
136 return(&ut
->uu_rval
[0]);