aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/Kconfig189
-rw-r--r--arch/um/Kconfig.char139
-rw-r--r--arch/um/Kconfig.debug24
-rw-r--r--arch/um/Makefile8
-rw-r--r--arch/um/include/sysdep-i386/sigcontext.h12
-rw-r--r--arch/um/kernel/Makefile2
-rw-r--r--arch/um/kernel/init_task.c8
-rw-r--r--arch/um/kernel/smp.c31
-rw-r--r--arch/um/kernel/trap.c111
-rw-r--r--arch/um/os-Linux/Makefile2
-rw-r--r--arch/um/os-Linux/sys-i386/Makefile2
-rw-r--r--arch/um/os-Linux/time.c38
-rw-r--r--arch/um/os-Linux/tls.c4
-rw-r--r--arch/um/sys-i386/Makefile4
-rw-r--r--arch/um/sys-i386/ptrace_user.c13
15 files changed, 278 insertions, 309 deletions
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index a0e47e271156..4aabb334a84e 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -66,12 +66,12 @@ config STATIC_LINK
66 bool "Force a static link" 66 bool "Force a static link"
67 default n 67 default n
68 help 68 help
69 This option gives you the ability to force a static link of UML. 69 This option gives you the ability to force a static link of UML.
70 Normally, UML is linked as a shared binary. This is inconvenient for 70 Normally, UML is linked as a shared binary. This is inconvenient for
71 use in a chroot jail. So, if you intend to run UML inside a chroot, 71 use in a chroot jail. So, if you intend to run UML inside a chroot,
72 you probably want to say Y here. 72 you probably want to say Y here.
73 Additionally, this option enables using higher memory spaces (up to 73 Additionally, this option enables using higher memory spaces (up to
74 2.75G) for UML. 74 2.75G) for UML.
75 75
76source "arch/um/Kconfig.arch" 76source "arch/um/Kconfig.arch"
77source "mm/Kconfig" 77source "mm/Kconfig"
@@ -89,18 +89,18 @@ config LD_SCRIPT_DYN
89config NET 89config NET
90 bool "Networking support" 90 bool "Networking support"
91 help 91 help
92 Unless you really know what you are doing, you should say Y here. 92 Unless you really know what you are doing, you should say Y here.
93 The reason is that some programs need kernel networking support even 93 The reason is that some programs need kernel networking support even
94 when running on a stand-alone machine that isn't connected to any 94 when running on a stand-alone machine that isn't connected to any
95 other computer. If you are upgrading from an older kernel, you 95 other computer. If you are upgrading from an older kernel, you
96 should consider updating your networking tools too because changes 96 should consider updating your networking tools too because changes
97 in the kernel and the tools often go hand in hand. The tools are 97 in the kernel and the tools often go hand in hand. The tools are
98 contained in the package net-tools, the location and version number 98 contained in the package net-tools, the location and version number
99 of which are given in <file:Documentation/Changes>. 99 of which are given in <file:Documentation/Changes>.
100 100
101 For a general introduction to Linux networking, it is highly 101 For a general introduction to Linux networking, it is highly
102 recommended to read the NET-HOWTO, available from 102 recommended to read the NET-HOWTO, available from
103 <http://www.tldp.org/docs.html#howto>. 103 <http://www.tldp.org/docs.html#howto>.
104 104
105 105
106source "fs/Kconfig.binfmt" 106source "fs/Kconfig.binfmt"
@@ -108,74 +108,74 @@ source "fs/Kconfig.binfmt"
108config HOSTFS 108config HOSTFS
109 tristate "Host filesystem" 109 tristate "Host filesystem"
110 help 110 help
111 While the User-Mode Linux port uses its own root file system for 111 While the User-Mode Linux port uses its own root file system for
112 booting and normal file access, this module lets the UML user 112 booting and normal file access, this module lets the UML user
113 access files stored on the host. It does not require any 113 access files stored on the host. It does not require any
114 network connection between the Host and UML. An example use of 114 network connection between the Host and UML. An example use of
115 this might be: 115 this might be:
116 116
117 mount none /tmp/fromhost -t hostfs -o /tmp/umlshare 117 mount none /tmp/fromhost -t hostfs -o /tmp/umlshare
118 118
119 where /tmp/fromhost is an empty directory inside UML and 119 where /tmp/fromhost is an empty directory inside UML and
120 /tmp/umlshare is a directory on the host with files the UML user 120 /tmp/umlshare is a directory on the host with files the UML user
121 wishes to access. 121 wishes to access.
122 122
123 For more information, see 123 For more information, see
124 <http://user-mode-linux.sourceforge.net/hostfs.html>. 124 <http://user-mode-linux.sourceforge.net/hostfs.html>.
125 125
126 If you'd like to be able to work with files stored on the host, 126 If you'd like to be able to work with files stored on the host,
127 say Y or M here; otherwise say N. 127 say Y or M here; otherwise say N.
128 128
129config HPPFS 129config HPPFS
130 tristate "HoneyPot ProcFS (EXPERIMENTAL)" 130 tristate "HoneyPot ProcFS (EXPERIMENTAL)"
131 depends on EXPERIMENTAL 131 depends on EXPERIMENTAL
132 help 132 help
133 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc 133 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc
134 entries to be overridden, removed, or fabricated from the host. 134 entries to be overridden, removed, or fabricated from the host.
135 Its purpose is to allow a UML to appear to be a physical machine 135 Its purpose is to allow a UML to appear to be a physical machine
136 by removing or changing anything in /proc which gives away the 136 by removing or changing anything in /proc which gives away the
137 identity of a UML. 137 identity of a UML.
138 138
139 See <http://user-mode-linux.sf.net/hppfs.html> for more information. 139 See <http://user-mode-linux.sf.net/hppfs.html> for more information.
140 140
141 You only need this if you are setting up a UML honeypot. Otherwise, 141 You only need this if you are setting up a UML honeypot. Otherwise,
142 it is safe to say 'N' here. 142 it is safe to say 'N' here.
143 143
144config MCONSOLE 144config MCONSOLE
145 bool "Management console" 145 bool "Management console"
146 default y 146 default y
147 help 147 help
148 The user mode linux management console is a low-level interface to 148 The user mode linux management console is a low-level interface to
149 the kernel, somewhat like the i386 SysRq interface. Since there is 149 the kernel, somewhat like the i386 SysRq interface. Since there is
150 a full-blown operating system running under every user mode linux 150 a full-blown operating system running under every user mode linux
151 instance, there is much greater flexibility possible than with the 151 instance, there is much greater flexibility possible than with the
152 SysRq mechanism. 152 SysRq mechanism.
153 153
154 If you answer 'Y' to this option, to use this feature, you need the 154 If you answer 'Y' to this option, to use this feature, you need the
155 mconsole client (called uml_mconsole) which is present in CVS in 155 mconsole client (called uml_mconsole) which is present in CVS in
156 2.4.5-9um and later (path /tools/mconsole), and is also in the 156 2.4.5-9um and later (path /tools/mconsole), and is also in the
157 distribution RPM package in 2.4.6 and later. 157 distribution RPM package in 2.4.6 and later.
158 158
159 It is safe to say 'Y' here. 159 It is safe to say 'Y' here.
160 160
161config MAGIC_SYSRQ 161config MAGIC_SYSRQ
162 bool "Magic SysRq key" 162 bool "Magic SysRq key"
163 depends on MCONSOLE 163 depends on MCONSOLE
164 ---help--- 164 help
165 If you say Y here, you will have some control over the system even 165 If you say Y here, you will have some control over the system even
166 if the system crashes for example during kernel debugging (e.g., you 166 if the system crashes for example during kernel debugging (e.g., you
167 will be able to flush the buffer cache to disk, reboot the system 167 will be able to flush the buffer cache to disk, reboot the system
168 immediately or dump some status information). A key for each of the 168 immediately or dump some status information). A key for each of the
169 possible requests is provided. 169 possible requests is provided.
170 170
171 This is the feature normally accomplished by pressing a key 171 This is the feature normally accomplished by pressing a key
172 while holding SysRq (Alt+PrintScreen). 172 while holding SysRq (Alt+PrintScreen).
173 173
174 On UML, this is accomplished by sending a "sysrq" command with 174 On UML, this is accomplished by sending a "sysrq" command with
175 mconsole, followed by the letter for the requested command. 175 mconsole, followed by the letter for the requested command.
176 176
177 The keys are documented in <file:Documentation/sysrq.txt>. Don't say Y 177 The keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
178 unless you really know what this hack does. 178 unless you really know what this hack does.
179 179
180config SMP 180config SMP
181 bool "Symmetric multi-processing support (EXPERIMENTAL)" 181 bool "Symmetric multi-processing support (EXPERIMENTAL)"
@@ -183,24 +183,24 @@ config SMP
183 #SMP_BROKEN is for x86_64. 183 #SMP_BROKEN is for x86_64.
184 depends on EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN)) 184 depends on EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN))
185 help 185 help
186 This option enables UML SMP support. 186 This option enables UML SMP support.
187 It is NOT related to having a real SMP box. Not directly, at least. 187 It is NOT related to having a real SMP box. Not directly, at least.
188 188
189 UML implements virtual SMP by allowing as many processes to run 189 UML implements virtual SMP by allowing as many processes to run
190 simultaneously on the host as there are virtual processors configured. 190 simultaneously on the host as there are virtual processors configured.
191 191
192 Obviously, if the host is a uniprocessor, those processes will 192 Obviously, if the host is a uniprocessor, those processes will
193 timeshare, but, inside UML, will appear to be running simultaneously. 193 timeshare, but, inside UML, will appear to be running simultaneously.
194 If the host is a multiprocessor, then UML processes may run 194 If the host is a multiprocessor, then UML processes may run
195 simultaneously, depending on the host scheduler. 195 simultaneously, depending on the host scheduler.
196 196
197 This, however, is supported only in TT mode. So, if you use the SKAS 197 This, however, is supported only in TT mode. So, if you use the SKAS
198 patch on your host, switching to TT mode and enabling SMP usually gives 198 patch on your host, switching to TT mode and enabling SMP usually
199 you worse performances. 199 gives you worse performances.
200 Also, since the support for SMP has been under-developed, there could 200 Also, since the support for SMP has been under-developed, there could
201 be some bugs being exposed by enabling SMP. 201 be some bugs being exposed by enabling SMP.
202 202
203 If you don't know what to do, say N. 203 If you don't know what to do, say N.
204 204
205config NR_CPUS 205config NR_CPUS
206 int "Maximum number of CPUs (2-32)" 206 int "Maximum number of CPUs (2-32)"
@@ -212,24 +212,24 @@ config NEST_LEVEL
212 int "Nesting level" 212 int "Nesting level"
213 default "0" 213 default "0"
214 help 214 help
215 This is set to the number of layers of UMLs that this UML will be run 215 This is set to the number of layers of UMLs that this UML will be run
216 in. Normally, this is zero, meaning that it will run directly on the 216 in. Normally, this is zero, meaning that it will run directly on the
217 host. Setting it to one will build a UML that can run inside a UML 217 host. Setting it to one will build a UML that can run inside a UML
218 that is running on the host. Generally, if you intend this UML to run 218 that is running on the host. Generally, if you intend this UML to run
219 inside another UML, set CONFIG_NEST_LEVEL to one more than the host 219 inside another UML, set CONFIG_NEST_LEVEL to one more than the host
220 UML. 220 UML.
221 221
222config HIGHMEM 222config HIGHMEM
223 bool "Highmem support (EXPERIMENTAL)" 223 bool "Highmem support (EXPERIMENTAL)"
224 depends on !64BIT && EXPERIMENTAL 224 depends on !64BIT && EXPERIMENTAL
225 default n 225 default n
226 help 226 help
227 This was used to allow UML to run with big amounts of memory. 227 This was used to allow UML to run with big amounts of memory.
228 Currently it is unstable, so if unsure say N. 228 Currently it is unstable, so if unsure say N.
229 229
230 To use big amounts of memory, it is recommended enable static 230 To use big amounts of memory, it is recommended enable static
231 linking (i.e. CONFIG_STATIC_LINK) - this should allow the 231 linking (i.e. CONFIG_STATIC_LINK) - this should allow the
232 guest to use up to 2.75G of memory. 232 guest to use up to 2.75G of memory.
233 233
234config KERNEL_STACK_ORDER 234config KERNEL_STACK_ORDER
235 int "Kernel stack size order" 235 int "Kernel stack size order"
@@ -237,20 +237,21 @@ config KERNEL_STACK_ORDER
237 range 1 10 if 64BIT 237 range 1 10 if 64BIT
238 default 0 if !64BIT 238 default 0 if !64BIT
239 help 239 help
240 This option determines the size of UML kernel stacks. They will 240 This option determines the size of UML kernel stacks. They will
241 be 1 << order pages. The default is OK unless you're running Valgrind 241 be 1 << order pages. The default is OK unless you're running Valgrind
242 on UML, in which case, set this to 3. 242 on UML, in which case, set this to 3.
243 243
244config UML_REAL_TIME_CLOCK 244config UML_REAL_TIME_CLOCK
245 bool "Real-time Clock" 245 bool "Real-time Clock"
246 default y 246 default y
247 help 247 help
248 This option makes UML time deltas match wall clock deltas. This should 248 This option makes UML time deltas match wall clock deltas. This
249 normally be enabled. The exception would be if you are debugging with 249 should normally be enabled. The exception would be if you are
250 UML and spend long times with UML stopped at a breakpoint. In this 250 debugging with UML and spend long times with UML stopped at a
251 case, when UML is restarted, it will call the timer enough times to make 251 breakpoint. In this case, when UML is restarted, it will call the
252 up for the time spent at the breakpoint. This could result in a 252 timer enough times to make up for the time spent at the breakpoint.
253 noticeable lag. If this is a problem, then disable this option. 253 This could result in a noticeable lag. If this is a problem, then
254 disable this option.
254 255
255endmenu 256endmenu
256 257
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index 1168936fb153..9a78d354f0b4 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -5,7 +5,7 @@ config STDERR_CONSOLE
5 bool "stderr console" 5 bool "stderr console"
6 default y 6 default y
7 help 7 help
8 console driver which dumps all printk messages to stderr. 8 console driver which dumps all printk messages to stderr.
9 9
10config STDIO_CONSOLE 10config STDIO_CONSOLE
11 bool 11 bool
@@ -14,58 +14,58 @@ config STDIO_CONSOLE
14config SSL 14config SSL
15 bool "Virtual serial line" 15 bool "Virtual serial line"
16 help 16 help
17 The User-Mode Linux environment allows you to create virtual serial 17 The User-Mode Linux environment allows you to create virtual serial
18 lines on the UML that are usually made to show up on the host as 18 lines on the UML that are usually made to show up on the host as
19 ttys or ptys. 19 ttys or ptys.
20 20
21 See <http://user-mode-linux.sourceforge.net/input.html> for more 21 See <http://user-mode-linux.sourceforge.net/input.html> for more
22 information and command line examples of how to use this facility. 22 information and command line examples of how to use this facility.
23 23
24 Unless you have a specific reason for disabling this, say Y. 24 Unless you have a specific reason for disabling this, say Y.
25 25
26config NULL_CHAN 26config NULL_CHAN
27 bool "null channel support" 27 bool "null channel support"
28 help 28 help
29 This option enables support for attaching UML consoles and serial 29 This option enables support for attaching UML consoles and serial
30 lines to a device similar to /dev/null. Data written to it disappears 30 lines to a device similar to /dev/null. Data written to it disappears
31 and there is never any data to be read. 31 and there is never any data to be read.
32 32
33config PORT_CHAN 33config PORT_CHAN
34 bool "port channel support" 34 bool "port channel support"
35 help 35 help
36 This option enables support for attaching UML consoles and serial 36 This option enables support for attaching UML consoles and serial
37 lines to host portals. They may be accessed with 'telnet <host> 37 lines to host portals. They may be accessed with 'telnet <host>
38 <port number>'. Any number of consoles and serial lines may be 38 <port number>'. Any number of consoles and serial lines may be
39 attached to a single portal, although what UML device you get when 39 attached to a single portal, although what UML device you get when
40 you telnet to that portal will be unpredictable. 40 you telnet to that portal will be unpredictable.
41 It is safe to say 'Y' here. 41 It is safe to say 'Y' here.
42 42
43config PTY_CHAN 43config PTY_CHAN
44 bool "pty channel support" 44 bool "pty channel support"
45 help 45 help
46 This option enables support for attaching UML consoles and serial 46 This option enables support for attaching UML consoles and serial
47 lines to host pseudo-terminals. Access to both traditional 47 lines to host pseudo-terminals. Access to both traditional
48 pseudo-terminals (/dev/pty*) and pts pseudo-terminals are controlled 48 pseudo-terminals (/dev/pty*) and pts pseudo-terminals are controlled
49 with this option. The assignment of UML devices to host devices 49 with this option. The assignment of UML devices to host devices
50 will be announced in the kernel message log. 50 will be announced in the kernel message log.
51 It is safe to say 'Y' here. 51 It is safe to say 'Y' here.
52 52
53config TTY_CHAN 53config TTY_CHAN
54 bool "tty channel support" 54 bool "tty channel support"
55 help 55 help
56 This option enables support for attaching UML consoles and serial 56 This option enables support for attaching UML consoles and serial
57 lines to host terminals. Access to both virtual consoles 57 lines to host terminals. Access to both virtual consoles
58 (/dev/tty*) and the slave side of pseudo-terminals (/dev/ttyp* and 58 (/dev/tty*) and the slave side of pseudo-terminals (/dev/ttyp* and
59 /dev/pts/*) are controlled by this option. 59 /dev/pts/*) are controlled by this option.
60 It is safe to say 'Y' here. 60 It is safe to say 'Y' here.
61 61
62config XTERM_CHAN 62config XTERM_CHAN
63 bool "xterm channel support" 63 bool "xterm channel support"
64 help 64 help
65 This option enables support for attaching UML consoles and serial 65 This option enables support for attaching UML consoles and serial
66 lines to xterms. Each UML device so assigned will be brought up in 66 lines to xterms. Each UML device so assigned will be brought up in
67 its own xterm. 67 its own xterm.
68 It is safe to say 'Y' here. 68 It is safe to say 'Y' here.
69 69
70config NOCONFIG_CHAN 70config NOCONFIG_CHAN
71 bool 71 bool
@@ -75,39 +75,39 @@ config CON_ZERO_CHAN
75 string "Default main console channel initialization" 75 string "Default main console channel initialization"
76 default "fd:0,fd:1" 76 default "fd:0,fd:1"
77 help 77 help
78 This is the string describing the channel to which the main console 78 This is the string describing the channel to which the main console
79 will be attached by default. This value can be overridden from the 79 will be attached by default. This value can be overridden from the
80 command line. The default value is "fd:0,fd:1", which attaches the 80 command line. The default value is "fd:0,fd:1", which attaches the
81 main console to stdin and stdout. 81 main console to stdin and stdout.
82 It is safe to leave this unchanged. 82 It is safe to leave this unchanged.
83 83
84config CON_CHAN 84config CON_CHAN
85 string "Default console channel initialization" 85 string "Default console channel initialization"
86 default "xterm" 86 default "xterm"
87 help 87 help
88 This is the string describing the channel to which all consoles 88 This is the string describing the channel to which all consoles
89 except the main console will be attached by default. This value can 89 except the main console will be attached by default. This value can
90 be overridden from the command line. The default value is "xterm", 90 be overridden from the command line. The default value is "xterm",
91 which brings them up in xterms. 91 which brings them up in xterms.
92 It is safe to leave this unchanged, although you may wish to change 92 It is safe to leave this unchanged, although you may wish to change
93 this if you expect the UML that you build to be run in environments 93 this if you expect the UML that you build to be run in environments
94 which don't have X or xterm available. 94 which don't have X or xterm available.
95 95
96config SSL_CHAN 96config SSL_CHAN
97 string "Default serial line channel initialization" 97 string "Default serial line channel initialization"
98 default "pty" 98 default "pty"
99 help 99 help
100 This is the string describing the channel to which the serial lines 100 This is the string describing the channel to which the serial lines
101 will be attached by default. This value can be overridden from the 101 will be attached by default. This value can be overridden from the
102 command line. The default value is "pty", which attaches them to 102 command line. The default value is "pty", which attaches them to
103 traditional pseudo-terminals. 103 traditional pseudo-terminals.
104 It is safe to leave this unchanged, although you may wish to change 104 It is safe to leave this unchanged, although you may wish to change
105 this if you expect the UML that you build to be run in environments 105 this if you expect the UML that you build to be run in environments
106 which don't have a set of /dev/pty* devices. 106 which don't have a set of /dev/pty* devices.
107 107
108config UNIX98_PTYS 108config UNIX98_PTYS
109 bool "Unix98 PTY support" 109 bool "Unix98 PTY support"
110 ---help--- 110 help
111 A pseudo terminal (PTY) is a software device consisting of two 111 A pseudo terminal (PTY) is a software device consisting of two
112 halves: a master and a slave. The slave device behaves identical to 112 halves: a master and a slave. The slave device behaves identical to
113 a physical terminal; the master device is used by a process to 113 a physical terminal; the master device is used by a process to
@@ -130,7 +130,7 @@ config UNIX98_PTYS
130config LEGACY_PTYS 130config LEGACY_PTYS
131 bool "Legacy (BSD) PTY support" 131 bool "Legacy (BSD) PTY support"
132 default y 132 default y
133 ---help--- 133 help
134 A pseudo terminal (PTY) is a software device consisting of two 134 A pseudo terminal (PTY) is a software device consisting of two
135 halves: a master and a slave. The slave device behaves identical to 135 halves: a master and a slave. The slave device behaves identical to
136 a physical terminal; the master device is used by a process to 136 a physical terminal; the master device is used by a process to
@@ -168,7 +168,7 @@ config LEGACY_PTY_COUNT
168 int "Maximum number of legacy PTY in use" 168 int "Maximum number of legacy PTY in use"
169 depends on LEGACY_PTYS 169 depends on LEGACY_PTYS
170 default "256" 170 default "256"
171 ---help--- 171 help
172 The maximum number of legacy PTYs that can be used at any one time. 172 The maximum number of legacy PTYs that can be used at any one time.
173 The default is 256, and should be more than enough. Embedded 173 The default is 256, and should be more than enough. Embedded
174 systems may want to reduce this to save memory. 174 systems may want to reduce this to save memory.
@@ -194,10 +194,10 @@ config UML_WATCHDOG
194config UML_SOUND 194config UML_SOUND
195 tristate "Sound support" 195 tristate "Sound support"
196 help 196 help
197 This option enables UML sound support. If enabled, it will pull in 197 This option enables UML sound support. If enabled, it will pull in
198 soundcore and the UML hostaudio relay, which acts as a intermediary 198 soundcore and the UML hostaudio relay, which acts as a intermediary
199 between the host's dsp and mixer devices and the UML sound system. 199 between the host's dsp and mixer devices and the UML sound system.
200 It is safe to say 'Y' here. 200 It is safe to say 'Y' here.
201 201
202config SOUND 202config SOUND
203 tristate 203 tristate
@@ -215,22 +215,21 @@ config HW_RANDOM
215config UML_RANDOM 215config UML_RANDOM
216 tristate "Hardware random number generator" 216 tristate "Hardware random number generator"
217 help 217 help
218 This option enables UML's "hardware" random number generator. It 218 This option enables UML's "hardware" random number generator. It
219 attaches itself to the host's /dev/random, supplying as much entropy 219 attaches itself to the host's /dev/random, supplying as much entropy
220 as the host has, rather than the small amount the UML gets from its 220 as the host has, rather than the small amount the UML gets from its
221 own drivers. It registers itself as a standard hardware random number 221 own drivers. It registers itself as a standard hardware random number
222 generator, major 10, minor 183, and the canonical device name is 222 generator, major 10, minor 183, and the canonical device name is
223 /dev/hwrng. 223 /dev/hwrng.
224 The way to make use of this is to install the rng-tools package 224 The way to make use of this is to install the rng-tools package
225 (check your distro, or download from 225 (check your distro, or download from
226 http://sourceforge.net/projects/gkernel/). rngd periodically reads 226 http://sourceforge.net/projects/gkernel/). rngd periodically reads
227 /dev/hwrng and injects the entropy into /dev/random. 227 /dev/hwrng and injects the entropy into /dev/random.
228 228
229config MMAPPER 229config MMAPPER
230 tristate "iomem emulation driver" 230 tristate "iomem emulation driver"
231 help 231 help
232 This driver allows a host file to be used as emulated IO memory inside 232 This driver allows a host file to be used as emulated IO memory inside
233 UML. 233 UML.
234 234
235endmenu 235endmenu
236
diff --git a/arch/um/Kconfig.debug b/arch/um/Kconfig.debug
index 1eace4bd6616..1f6462ffd3e8 100644
--- a/arch/um/Kconfig.debug
+++ b/arch/um/Kconfig.debug
@@ -6,27 +6,27 @@ config GPROF
6 bool "Enable gprof support" 6 bool "Enable gprof support"
7 depends on DEBUG_INFO 7 depends on DEBUG_INFO
8 help 8 help
9 This allows profiling of a User-Mode Linux kernel with the gprof 9 This allows profiling of a User-Mode Linux kernel with the gprof
10 utility. 10 utility.
11 11
12 See <http://user-mode-linux.sourceforge.net/gprof.html> for more 12 See <http://user-mode-linux.sourceforge.net/gprof.html> for more
13 details. 13 details.
14 14
15 If you're involved in UML kernel development and want to use gprof, 15 If you're involved in UML kernel development and want to use gprof,
16 say Y. If you're unsure, say N. 16 say Y. If you're unsure, say N.
17 17
18config GCOV 18config GCOV
19 bool "Enable gcov support" 19 bool "Enable gcov support"
20 depends on DEBUG_INFO 20 depends on DEBUG_INFO
21 help 21 help
22 This option allows developers to retrieve coverage data from a UML 22 This option allows developers to retrieve coverage data from a UML
23 session. 23 session.
24 24
25 See <http://user-mode-linux.sourceforge.net/gprof.html> for more 25 See <http://user-mode-linux.sourceforge.net/gprof.html> for more
26 details. 26 details.
27 27
28 If you're involved in UML kernel development and want to use gcov, 28 If you're involved in UML kernel development and want to use gcov,
29 say Y. If you're unsure, say N. 29 say Y. If you're unsure, say N.
30 30
31config DEBUG_STACK_USAGE 31config DEBUG_STACK_USAGE
32 bool "Stack utilization instrumentation" 32 bool "Stack utilization instrumentation"
diff --git a/arch/um/Makefile b/arch/um/Makefile
index e7aa0535f5d9..ab22fdeedf29 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -2,7 +2,7 @@
2# This file is included by the global makefile so that you can add your own 2# This file is included by the global makefile so that you can add your own
3# architecture-specific flags and dependencies. 3# architecture-specific flags and dependencies.
4# 4#
5# Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 5# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
6# Licensed under the GPL 6# Licensed under the GPL
7# 7#
8 8
@@ -124,7 +124,7 @@ endif
124CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ 124CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
125 -DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE) 125 -DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)
126 126
127#The wrappers will select whether using "malloc" or the kernel allocator. 127# The wrappers will select whether using "malloc" or the kernel allocator.
128LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc 128LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
129 129
130CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) 130CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS)
@@ -137,8 +137,8 @@ define cmd_vmlinux__
137 FORCE ,$^) ; rm -f linux 137 FORCE ,$^) ; rm -f linux
138endef 138endef
139 139
140#When cleaning we don't include .config, so we don't include 140# When cleaning we don't include .config, so we don't include
141#TT or skas makefiles and don't clean skas_ptregs.h. 141# TT or skas makefiles and don't clean skas_ptregs.h.
142CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ 142CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
143 $(ARCH_DIR)/include/user_constants.h \ 143 $(ARCH_DIR)/include/user_constants.h \
144 $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch 144 $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h
index a930ce3d4831..3050a6aaed7a 100644
--- a/arch/um/include/sysdep-i386/sigcontext.h
+++ b/arch/um/include/sysdep-i386/sigcontext.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -37,13 +37,3 @@ extern unsigned long *sc_sigmask(void *sc_ptr);
37extern int sc_get_fpregs(unsigned long buf, void *sc_ptr); 37extern int sc_get_fpregs(unsigned long buf, void *sc_ptr);
38 38
39#endif 39#endif
40/*
41 * Overrides for Emacs so that we follow Linus's tabbing style.
42 * Emacs will notice this stuff at the end of the file and automatically
43 * adjust the settings for this buffer only. This must remain at the end
44 * of the file.
45 * ---------------------------------------------------------------------------
46 * Local variables:
47 * c-file-style: "linux"
48 * End:
49 */
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 6651937a2d26..499e5e95e609 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux,intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index 33055082356e..dcfceca95052 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -3,16 +3,12 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/mm.h"
7#include "linux/fs.h"
8#include "linux/module.h"
9#include "linux/sched.h" 6#include "linux/sched.h"
10#include "linux/init_task.h" 7#include "linux/init_task.h"
8#include "linux/fs.h"
9#include "linux/module.h"
11#include "linux/mqueue.h" 10#include "linux/mqueue.h"
12#include "asm/uaccess.h" 11#include "asm/uaccess.h"
13#include "asm/pgtable.h"
14#include "mem_user.h"
15#include "os.h"
16 12
17static struct fs_struct init_fs = INIT_FS; 13static struct fs_struct init_fs = INIT_FS;
18struct mm_struct init_mm = INIT_MM(init_mm); 14struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index 15bb54365779..36d89cf8d20b 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -56,12 +56,12 @@ void smp_send_stop(void)
56 int i; 56 int i;
57 57
58 printk(KERN_INFO "Stopping all CPUs..."); 58 printk(KERN_INFO "Stopping all CPUs...");
59 for(i = 0; i < num_online_cpus(); i++){ 59 for (i = 0; i < num_online_cpus(); i++) {
60 if(i == current_thread->cpu) 60 if (i == current_thread->cpu)
61 continue; 61 continue;
62 os_write_file(cpu_data[i].ipi_pipe[1], "S", 1); 62 os_write_file(cpu_data[i].ipi_pipe[1], "S", 1);
63 } 63 }
64 printk("done\n"); 64 printk(KERN_INFO "done\n");
65} 65}
66 66
67static cpumask_t smp_commenced_mask = CPU_MASK_NONE; 67static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
@@ -72,7 +72,7 @@ static int idle_proc(void *cpup)
72 int cpu = (int) cpup, err; 72 int cpu = (int) cpup, err;
73 73
74 err = os_pipe(cpu_data[cpu].ipi_pipe, 1, 1); 74 err = os_pipe(cpu_data[cpu].ipi_pipe, 1, 1);
75 if(err < 0) 75 if (err < 0)
76 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err); 76 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err);
77 77
78 os_set_fd_async(cpu_data[cpu].ipi_pipe[0], 78 os_set_fd_async(cpu_data[cpu].ipi_pipe[0],
@@ -80,7 +80,7 @@ static int idle_proc(void *cpup)
80 80
81 wmb(); 81 wmb();
82 if (cpu_test_and_set(cpu, cpu_callin_map)) { 82 if (cpu_test_and_set(cpu, cpu_callin_map)) {
83 printk("huh, CPU#%d already present??\n", cpu); 83 printk(KERN_ERR "huh, CPU#%d already present??\n", cpu);
84 BUG(); 84 BUG();
85 } 85 }
86 86
@@ -99,7 +99,7 @@ static struct task_struct *idle_thread(int cpu)
99 current->thread.request.u.thread.proc = idle_proc; 99 current->thread.request.u.thread.proc = idle_proc;
100 current->thread.request.u.thread.arg = (void *) cpu; 100 current->thread.request.u.thread.arg = (void *) cpu;
101 new_task = fork_idle(cpu); 101 new_task = fork_idle(cpu);
102 if(IS_ERR(new_task)) 102 if (IS_ERR(new_task))
103 panic("copy_process failed in idle_thread, error = %ld", 103 panic("copy_process failed in idle_thread, error = %ld",
104 PTR_ERR(new_task)); 104 PTR_ERR(new_task));
105 105
@@ -126,14 +126,14 @@ void smp_prepare_cpus(unsigned int maxcpus)
126 cpu_set(me, cpu_callin_map); 126 cpu_set(me, cpu_callin_map);
127 127
128 err = os_pipe(cpu_data[me].ipi_pipe, 1, 1); 128 err = os_pipe(cpu_data[me].ipi_pipe, 1, 1);
129 if(err < 0) 129 if (err < 0)
130 panic("CPU#0 failed to create IPI pipe, errno = %d", -err); 130 panic("CPU#0 failed to create IPI pipe, errno = %d", -err);
131 131
132 os_set_fd_async(cpu_data[me].ipi_pipe[0], 132 os_set_fd_async(cpu_data[me].ipi_pipe[0],
133 current->thread.mode.tt.extern_pid); 133 current->thread.mode.tt.extern_pid);
134 134
135 for(cpu = 1; cpu < ncpus; cpu++){ 135 for (cpu = 1; cpu < ncpus; cpu++) {
136 printk("Booting processor %d...\n", cpu); 136 printk(KERN_INFO "Booting processor %d...\n", cpu);
137 137
138 idle = idle_thread(cpu); 138 idle = idle_thread(cpu);
139 139
@@ -144,8 +144,8 @@ void smp_prepare_cpus(unsigned int maxcpus)
144 cpu_relax(); 144 cpu_relax();
145 145
146 if (cpu_isset(cpu, cpu_callin_map)) 146 if (cpu_isset(cpu, cpu_callin_map))
147 printk("done\n"); 147 printk(KERN_INFO "done\n");
148 else printk("failed\n"); 148 else printk(KERN_INFO "failed\n");
149 } 149 }
150} 150}
151 151
@@ -187,13 +187,14 @@ void IPI_handler(int cpu)
187 break; 187 break;
188 188
189 case 'S': 189 case 'S':
190 printk("CPU#%d stopping\n", cpu); 190 printk(KERN_INFO "CPU#%d stopping\n", cpu);
191 while(1) 191 while (1)
192 pause(); 192 pause();
193 break; 193 break;
194 194
195 default: 195 default:
196 printk("CPU#%d received unknown IPI [%c]!\n", cpu, c); 196 printk(KERN_ERR "CPU#%d received unknown IPI [%c]!\n",
197 cpu, c);
197 break; 198 break;
198 } 199 }
199 } 200 }
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index c517c449d0dd..4b472ca53485 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -1,38 +1,24 @@
1/* 1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/kernel.h" 6#include <linux/mm.h>
7#include "asm/errno.h" 7#include <linux/sched.h>
8#include "linux/sched.h" 8#include <linux/hardirq.h>
9#include "linux/mm.h" 9#include <asm/current.h>
10#include "linux/spinlock.h" 10#include <asm/pgtable.h>
11#include "linux/init.h" 11#include <asm/tlbflush.h>
12#include "linux/ptrace.h"
13#include "asm/semaphore.h"
14#include "asm/pgtable.h"
15#include "asm/pgalloc.h"
16#include "asm/tlbflush.h"
17#include "asm/a.out.h"
18#include "asm/current.h"
19#include "asm/irq.h"
20#include "sysdep/sigcontext.h"
21#include "kern_util.h"
22#include "as-layout.h"
23#include "arch.h" 12#include "arch.h"
24#include "kern.h" 13#include "as-layout.h"
25#include "chan_kern.h" 14#include "kern_util.h"
26#include "mconsole_kern.h"
27#include "mem.h"
28#include "mem_kern.h"
29#include "sysdep/sigcontext.h"
30#include "sysdep/ptrace.h"
31#include "os.h"
32#include "skas.h"
33#include "os.h" 15#include "os.h"
16#include "sysdep/sigcontext.h"
34 17
35/* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ 18/*
19 * Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by
20 * segv().
21 */
36int handle_page_fault(unsigned long address, unsigned long ip, 22int handle_page_fault(unsigned long address, unsigned long ip,
37 int is_write, int is_user, int *code_out) 23 int is_write, int is_user, int *code_out)
38{ 24{
@@ -46,31 +32,33 @@ int handle_page_fault(unsigned long address, unsigned long ip,
46 32
47 *code_out = SEGV_MAPERR; 33 *code_out = SEGV_MAPERR;
48 34
49 /* If the fault was during atomic operation, don't take the fault, just 35 /*
50 * fail. */ 36 * If the fault was during atomic operation, don't take the fault, just
37 * fail.
38 */
51 if (in_atomic()) 39 if (in_atomic())
52 goto out_nosemaphore; 40 goto out_nosemaphore;
53 41
54 down_read(&mm->mmap_sem); 42 down_read(&mm->mmap_sem);
55 vma = find_vma(mm, address); 43 vma = find_vma(mm, address);
56 if(!vma) 44 if (!vma)
57 goto out; 45 goto out;
58 else if(vma->vm_start <= address) 46 else if (vma->vm_start <= address)
59 goto good_area; 47 goto good_area;
60 else if(!(vma->vm_flags & VM_GROWSDOWN)) 48 else if (!(vma->vm_flags & VM_GROWSDOWN))
61 goto out; 49 goto out;
62 else if(is_user && !ARCH_IS_STACKGROW(address)) 50 else if (is_user && !ARCH_IS_STACKGROW(address))
63 goto out; 51 goto out;
64 else if(expand_stack(vma, address)) 52 else if (expand_stack(vma, address))
65 goto out; 53 goto out;
66 54
67good_area: 55good_area:
68 *code_out = SEGV_ACCERR; 56 *code_out = SEGV_ACCERR;
69 if(is_write && !(vma->vm_flags & VM_WRITE)) 57 if (is_write && !(vma->vm_flags & VM_WRITE))
70 goto out; 58 goto out;
71 59
72 /* Don't require VM_READ|VM_EXEC for write faults! */ 60 /* Don't require VM_READ|VM_EXEC for write faults! */
73 if(!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC))) 61 if (!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC)))
74 goto out; 62 goto out;
75 63
76 do { 64 do {
@@ -96,9 +84,10 @@ survive:
96 pud = pud_offset(pgd, address); 84 pud = pud_offset(pgd, address);
97 pmd = pmd_offset(pud, address); 85 pmd = pmd_offset(pud, address);
98 pte = pte_offset_kernel(pmd, address); 86 pte = pte_offset_kernel(pmd, address);
99 } while(!pte_present(*pte)); 87 } while (!pte_present(*pte));
100 err = 0; 88 err = 0;
101 /* The below warning was added in place of 89 /*
90 * The below warning was added in place of
102 * pte_mkyoung(); if (is_write) pte_mkdirty(); 91 * pte_mkyoung(); if (is_write) pte_mkdirty();
103 * If it's triggered, we'd see normally a hang here (a clean pte is 92 * If it's triggered, we'd see normally a hang here (a clean pte is
104 * marked read-only to emulate the dirty bit). 93 * marked read-only to emulate the dirty bit).
@@ -112,7 +101,7 @@ survive:
112out: 101out:
113 up_read(&mm->mmap_sem); 102 up_read(&mm->mmap_sem);
114out_nosemaphore: 103out_nosemaphore:
115 return(err); 104 return err;
116 105
117/* 106/*
118 * We ran out of memory, or some other thing happened to us that made 107 * We ran out of memory, or some other thing happened to us that made
@@ -143,7 +132,7 @@ static void segv_handler(int sig, union uml_pt_regs *regs)
143{ 132{
144 struct faultinfo * fi = UPT_FAULTINFO(regs); 133 struct faultinfo * fi = UPT_FAULTINFO(regs);
145 134
146 if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ 135 if (UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)) {
147 bad_segv(*fi, UPT_IP(regs)); 136 bad_segv(*fi, UPT_IP(regs));
148 return; 137 return;
149 } 138 }
@@ -165,37 +154,41 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
165 int is_write = FAULT_WRITE(fi); 154 int is_write = FAULT_WRITE(fi);
166 unsigned long address = FAULT_ADDRESS(fi); 155 unsigned long address = FAULT_ADDRESS(fi);
167 156
168 if(!is_user && (address >= start_vm) && (address < end_vm)){ 157 if (!is_user && (address >= start_vm) && (address < end_vm)) {
169 flush_tlb_kernel_vm(); 158 flush_tlb_kernel_vm();
170 return 0; 159 return 0;
171 } 160 }
172 else if(current->mm == NULL) { 161 else if (current->mm == NULL) {
173 show_regs(container_of(regs, struct pt_regs, regs)); 162 show_regs(container_of(regs, struct pt_regs, regs));
174 panic("Segfault with no mm"); 163 panic("Segfault with no mm");
175 } 164 }
176 165
177 if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi)) 166 if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi))
178 err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); 167 err = handle_page_fault(address, ip, is_write, is_user,
168 &si.si_code);
179 else { 169 else {
180 err = -EFAULT; 170 err = -EFAULT;
181 /* A thread accessed NULL, we get a fault, but CR2 is invalid. 171 /*
182 * This code is used in __do_copy_from_user() of TT mode. */ 172 * A thread accessed NULL, we get a fault, but CR2 is invalid.
173 * This code is used in __do_copy_from_user() of TT mode.
174 * XXX tt mode is gone, so maybe this isn't needed any more
175 */
183 address = 0; 176 address = 0;
184 } 177 }
185 178
186 catcher = current->thread.fault_catcher; 179 catcher = current->thread.fault_catcher;
187 if(!err) 180 if (!err)
188 return 0; 181 return 0;
189 else if(catcher != NULL){ 182 else if (catcher != NULL) {
190 current->thread.fault_addr = (void *) address; 183 current->thread.fault_addr = (void *) address;
191 do_longjmp(catcher, 1); 184 do_longjmp(catcher, 1);
192 } 185 }
193 else if(current->thread.fault_addr != NULL) 186 else if (current->thread.fault_addr != NULL)
194 panic("fault_addr set but no fault catcher"); 187 panic("fault_addr set but no fault catcher");
195 else if(!is_user && arch_fixup(ip, regs)) 188 else if (!is_user && arch_fixup(ip, regs))
196 return 0; 189 return 0;
197 190
198 if(!is_user) { 191 if (!is_user) {
199 show_regs(container_of(regs, struct pt_regs, regs)); 192 show_regs(container_of(regs, struct pt_regs, regs));
200 panic("Kernel mode fault at addr 0x%lx, ip 0x%lx", 193 panic("Kernel mode fault at addr 0x%lx, ip 0x%lx",
201 address, ip); 194 address, ip);
@@ -209,7 +202,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
209 current->thread.arch.faultinfo = fi; 202 current->thread.arch.faultinfo = fi;
210 force_sig_info(SIGBUS, &si, current); 203 force_sig_info(SIGBUS, &si, current);
211 } else if (err == -ENOMEM) { 204 } else if (err == -ENOMEM) {
212 printk("VM: killing process %s\n", current->comm); 205 printk(KERN_INFO "VM: killing process %s\n", current->comm);
213 do_exit(SIGKILL); 206 do_exit(SIGKILL);
214 } else { 207 } else {
215 BUG_ON(err != -EFAULT); 208 BUG_ON(err != -EFAULT);
@@ -223,13 +216,13 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
223 216
224void relay_signal(int sig, union uml_pt_regs *regs) 217void relay_signal(int sig, union uml_pt_regs *regs)
225{ 218{
226 if(arch_handle_signal(sig, regs)) 219 if (arch_handle_signal(sig, regs))
227 return; 220 return;
228 221
229 if(!UPT_IS_USER(regs)){ 222 if (!UPT_IS_USER(regs)) {
230 if(sig == SIGBUS) 223 if (sig == SIGBUS)
231 printk("Bus error - the host /dev/shm or /tmp mount " 224 printk(KERN_ERR "Bus error - the host /dev/shm or /tmp "
232 "likely just ran out of space\n"); 225 "mount likely just ran out of space\n");
233 panic("Kernel mode signal %d", sig); 226 panic("Kernel mode signal %d", sig);
234 } 227 }
235 228
@@ -239,7 +232,7 @@ void relay_signal(int sig, union uml_pt_regs *regs)
239 232
240static void bus_handler(int sig, union uml_pt_regs *regs) 233static void bus_handler(int sig, union uml_pt_regs *regs)
241{ 234{
242 if(current->thread.fault_catcher != NULL) 235 if (current->thread.fault_catcher != NULL)
243 do_longjmp(current->thread.fault_catcher, 1); 236 do_longjmp(current->thread.fault_catcher, 1);
244 else relay_signal(sig, regs); 237 else relay_signal(sig, regs);
245} 238}
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index 1dbb45dfc49b..8e129af8170d 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
diff --git a/arch/um/os-Linux/sys-i386/Makefile b/arch/um/os-Linux/sys-i386/Makefile
index dc7208f0b741..a841262c594a 100644
--- a/arch/um/os-Linux/sys-i386/Makefile
+++ b/arch/um/os-Linux/sys-i386/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 5eb32d24ba58..f22fcdfd4250 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -1,21 +1,17 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h> 6#include <stddef.h>
7#include <stdlib.h> 7#include <errno.h>
8#include <unistd.h> 8#include <signal.h>
9#include <time.h> 9#include <time.h>
10#include <sys/time.h> 10#include <sys/time.h>
11#include <signal.h>
12#include <errno.h>
13#include "kern_util.h" 11#include "kern_util.h"
14#include "user.h"
15#include "process.h"
16#include "kern_constants.h" 12#include "kern_constants.h"
17#include "os.h" 13#include "os.h"
18#include "uml-config.h" 14#include "user.h"
19 15
20int set_interval(int is_virtual) 16int set_interval(int is_virtual)
21{ 17{
@@ -24,7 +20,7 @@ int set_interval(int is_virtual)
24 struct itimerval interval = ((struct itimerval) { { 0, usec }, 20 struct itimerval interval = ((struct itimerval) { { 0, usec },
25 { 0, usec } }); 21 { 0, usec } });
26 22
27 if(setitimer(timer_type, &interval, NULL) == -1) 23 if (setitimer(timer_type, &interval, NULL) == -1)
28 return -errno; 24 return -errno;
29 25
30 return 0; 26 return 0;
@@ -33,10 +29,12 @@ int set_interval(int is_virtual)
33void disable_timer(void) 29void disable_timer(void)
34{ 30{
35 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); 31 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
36 if((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) || 32
37 (setitimer(ITIMER_REAL, &disable, NULL) < 0)) 33 if ((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) ||
38 printk("disnable_timer - setitimer failed, errno = %d\n", 34 (setitimer(ITIMER_REAL, &disable, NULL) < 0))
39 errno); 35 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
36 "errno = %d\n", errno);
37
40 /* If there are signals already queued, after unblocking ignore them */ 38 /* If there are signals already queued, after unblocking ignore them */
41 signal(SIGALRM, SIG_IGN); 39 signal(SIGALRM, SIG_IGN);
42 signal(SIGVTALRM, SIG_IGN); 40 signal(SIGVTALRM, SIG_IGN);
@@ -49,7 +47,7 @@ void switch_timers(int to_real)
49 { 0, 1000000/hz() }}); 47 { 0, 1000000/hz() }});
50 int old, new; 48 int old, new;
51 49
52 if(to_real){ 50 if (to_real) {
53 old = ITIMER_VIRTUAL; 51 old = ITIMER_VIRTUAL;
54 new = ITIMER_REAL; 52 new = ITIMER_REAL;
55 } 53 }
@@ -58,10 +56,10 @@ void switch_timers(int to_real)
58 new = ITIMER_VIRTUAL; 56 new = ITIMER_VIRTUAL;
59 } 57 }
60 58
61 if((setitimer(old, &disable, NULL) < 0) || 59 if ((setitimer(old, &disable, NULL) < 0) ||
62 (setitimer(new, &enable, NULL))) 60 (setitimer(new, &enable, NULL)))
63 printk("switch_timers - setitimer failed, errno = %d\n", 61 printk(UM_KERN_ERR "switch_timers - setitimer failed, "
64 errno); 62 "errno = %d\n", errno);
65} 63}
66 64
67unsigned long long os_nsecs(void) 65unsigned long long os_nsecs(void)
@@ -69,7 +67,7 @@ unsigned long long os_nsecs(void)
69 struct timeval tv; 67 struct timeval tv;
70 68
71 gettimeofday(&tv, NULL); 69 gettimeofday(&tv, NULL);
72 return((unsigned long long) tv.tv_sec * BILLION + tv.tv_usec * 1000); 70 return (unsigned long long) tv.tv_sec * BILLION + tv.tv_usec * 1000;
73} 71}
74 72
75void idle_sleep(int secs) 73void idle_sleep(int secs)
diff --git a/arch/um/os-Linux/tls.c b/arch/um/os-Linux/tls.c
index 282bd25e19ef..73277801ef14 100644
--- a/arch/um/os-Linux/tls.c
+++ b/arch/um/os-Linux/tls.c
@@ -1,10 +1,6 @@
1#include <errno.h> 1#include <errno.h>
2#include <unistd.h>
3#include <sys/ptrace.h> 2#include <sys/ptrace.h>
4#include <sys/syscall.h>
5#include <asm/ldt.h>
6#include "sysdep/tls.h" 3#include "sysdep/tls.h"
7#include "uml-config.h"
8 4
9/* TLS support - we basically rely on the host's one.*/ 5/* TLS support - we basically rely on the host's one.*/
10 6
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 94b6ede5ef6c..9468cf364843 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -1,3 +1,7 @@
1#
2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3#
4
1obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ 5obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
2 ptrace_user.o setjmp.o signal.o sigcontext.o stub.o stub_segv.o \ 6 ptrace_user.o setjmp.o signal.o sigcontext.o stub.o stub_segv.o \
3 syscalls.o sysrq.o sys_call_table.o tls.o 7 syscalls.o sysrq.o sys_call_table.o tls.o
diff --git a/arch/um/sys-i386/ptrace_user.c b/arch/um/sys-i386/ptrace_user.c
index 15e3349961d0..5cf97bc229b9 100644
--- a/arch/um/sys-i386/ptrace_user.c
+++ b/arch/um/sys-i386/ptrace_user.c
@@ -1,19 +1,10 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h>
7#include <stddef.h>
8#include <errno.h> 6#include <errno.h>
9#include <unistd.h> 7#include <sys/ptrace.h>
10#include "ptrace_user.h"
11/* Grr, asm/user.h includes asm/ptrace.h, so has to follow ptrace_user.h */
12#include <asm/user.h>
13#include "kern_util.h"
14#include "user.h"
15#include "os.h"
16#include "uml-config.h"
17 8
18int ptrace_getregs(long pid, unsigned long *regs_out) 9int ptrace_getregs(long pid, unsigned long *regs_out)
19{ 10{