FreeBSD/Linux Kernel Cross Reference
sys/i386/loose_ends.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: loose_ends.c,v $
29 * Revision 2.6 91/10/07 17:25:00 af
30 * Removed strlen(), which is now MI.
31 * [91/10/05 af]
32 *
33 * Revision 2.5 91/08/24 11:56:09 af
34 * Added delay() function, for where too much optim hurts.
35 * [91/08/02 02:47:21 af]
36 *
37 * Revision 2.4 91/05/14 16:11:30 mrt
38 * Correcting copyright
39 *
40 * Revision 2.3 91/02/05 17:13:06 mrt
41 * Changed to new Mach copyright
42 * [91/02/01 17:35:56 mrt]
43 *
44 * Revision 2.2 90/05/03 15:33:52 dbg
45 * Added strlen. Removed slave_config.
46 * [90/02/15 dbg]
47 *
48 * Revision 1.7.1.1 89/10/22 11:31:00 rvb
49 * gets() now in swapgeneric.c
50 * [89/10/17 rvb]
51 *
52 * Revision 1.7 89/09/20 17:26:29 rvb
53 * Back to zero. All this will be unnecessary when
54 * orr's boot parsing gets installed.
55 * [89/09/20 rvb]
56 *
57 * Revision 1.6 89/09/09 15:19:45 rvb
58 * boot how to -> 3
59 * [89/09/07 rvb]
60 *
61 * Revision 1.5 89/08/08 21:46:32 jsb
62 * Set boothowto to 0.
63 * [89/08/03 rvb]
64 *
65 * Revision 1.4 89/04/05 12:58:37 rvb
66 * Add kupfer's ovbcopy, till we recode it.
67 * [89/04/03 rvb]
68 *
69 * Temporarily need memcpy for gcc.
70 * [89/03/06 rvb]
71 *
72 * Revision 1.3 89/02/26 12:35:51 gm0w
73 * Changes for cleanup.
74 *
75 * 16-Feb-89 Robert Baron (rvb) at Carnegie-Mellon University
76 * Created
77 *
78 */
79
80 /*
81 * For now we will always go to single user mode, since there is
82 * no way pass this request through the boot.
83 */
84 int boothowto = 0;
85
86 /*
87 * Should be rewritten in asm anyway.
88 */
89 /*
90 * ovbcopy - like bcopy, but recognizes overlapping ranges and handles
91 * them correctly.
92 */
93 ovbcopy(from, to, bytes)
94 char *from, *to;
95 int bytes; /* num bytes to copy */
96 {
97 /* Assume that bcopy copies left-to-right (low addr first). */
98 if (from + bytes <= to || to + bytes <= from || to == from)
99 bcopy(from, to, bytes); /* non-overlapping or no-op*/
100 else if (from > to)
101 bcopy(from, to, bytes); /* overlapping but OK */
102 else {
103 /* to > from: overlapping, and must copy right-to-left. */
104 from += bytes - 1;
105 to += bytes - 1;
106 while (bytes-- > 0)
107 *to-- = *from--;
108 }
109 }
110
111 /* Someone with time should write code to set cpuspeed automagically */
112 int cpuspeed = 4;
113 #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
114 delay(n)
115 {
116 DELAY(n);
117 }
Cache object: 45a287d8e59f5fec0cb033aa5f54aca8
|