]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/machdep.c
e52c3ef84056b54eec2db18b390ba13cec4077b0
[apple/xnu.git] / bsd / dev / ppc / machdep.c
1 /*
2 * Copyright (c) 2000 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 Apple Computer, Inc. All rights reserved.
25 * Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
26 *
27 *
28 * Machine dependent cruft.
29 *
30 * 27-Apr-1997 A.Ramesh at Apple
31 *
32 *
33 */
34
35 #include <mach/mach_types.h>
36 #include <mach/machine.h>
37 #include <sys/reboot.h>
38
39 int reboot_how;
40 extern struct tty cons;
41 extern struct tty *constty; /* current console device */
42
43 extern int getchar();
44
45 #define putchar cnputc
46
47 void
48 gets(buf)
49 char *buf;
50 {
51 register char *lp;
52 register c;
53
54 lp = buf;
55 for (;;) {
56 c = getchar() & 0177;
57 switch(c) {
58 case '\n':
59 case '\r':
60 *lp++ = '\0';
61 return;
62 case '\b':
63 if (lp > buf) {
64 lp--;
65 putchar(' ');
66 putchar('\b');
67 }
68 continue;
69 case '#':
70 case '\177':
71 lp--;
72 if (lp < buf)
73 lp = buf;
74 continue;
75 case '@':
76 case 'u'&037:
77 lp = buf;
78 putchar('\n'); /* XXX calls 'cnputc' on mips */
79 continue;
80 default:
81 *lp++ = c;
82 }
83 }
84 }
85
86 int
87 getchar()
88 {
89 int c;
90
91 c = cngetc();
92 #if 0
93 if (c == 0x1b) /* ESC ? */
94 call_kdp();
95 #endif 0
96
97 if (c == '\r')
98 c = '\n';
99 cnputc(c);
100 return c;
101 }
102