Rev 51 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 51 | Rev 78 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | to fill gaps after functionality that the genuine HelenOS code did |
12 | to fill gaps after functionality that the genuine HelenOS code did |
13 | not provide itself. |
13 | not provide itself. |
14 | 14 | ||
15 | There is simply too much third party software that is somehow related to |
15 | There is simply too much third party software that is somehow related to |
16 | HelenOS to be covered all. This chapter attempts to present our experience |
16 | HelenOS to be covered all. This chapter attempts to present our experience |
17 | with the key softare tools, programs and libraries. |
17 | with the key software tools, programs and libraries. |
18 | 18 | ||
19 | \section{Communication tools} |
19 | \section{Communication tools} |
20 | Although the developers know each other in person, the development, with the |
20 | Although the developers know each other in person, the development, with the |
21 | exception of kernel camps, has been pretty much independent as far as locality |
21 | exception of kernel camps, has been pretty much independent as far as locality |
22 | and time goes. In order to work effectively, we have established several communication |
22 | and time goes. In order to work effectively, we have established several communication |
Line 115... | Line 115... | ||
115 | to control subsriptions and search mailing list archives on-line. |
115 | to control subsriptions and search mailing list archives on-line. |
116 | \end{description} |
116 | \end{description} |
117 | 117 | ||
118 | \section{Third party components of HelenOS} |
118 | \section{Third party components of HelenOS} |
119 | HelenOS itself contains third party software. In the first place, amd64 and ia32 architectures |
119 | HelenOS itself contains third party software. In the first place, amd64 and ia32 architectures |
120 | make use of GNU Grub boot loader. This software replaced the original limited boot loader |
120 | make use of the GNU Grub boot loader. This software replaced the original limited boot loader |
121 | after the Kernel Camp 2005 when {\MD} had made HelenOS Multiboot specification compliant. Because of |
121 | after the Kernel Camp 2005 when {\MD} had made HelenOS Multiboot specification compliant. Because of |
122 | Grub, HelenOS can be booted from several types of devices. More importantly, we use |
122 | Grub, HelenOS can be booted from several types of devices. More importantly, we use |
123 | Grub to load HelenOS userspace modules as well. |
123 | Grub to load HelenOS userspace modules as well. |
124 | 124 | ||
125 | Another third-party piece of the HelenOS operating system is the userspace {\tt malloc()}. |
125 | Another third-party piece of the HelenOS operating system is the userspace {\tt malloc()}. |
Line 127... | Line 127... | ||
127 | domain {\tt dlmalloc} instead. This allocator could be easily integrated into our uspace tree |
127 | domain {\tt dlmalloc} instead. This allocator could be easily integrated into our uspace tree |
128 | and has proven itself in other projects as well. Its derivative, {\tt ptmalloc}, has been part of the |
128 | and has proven itself in other projects as well. Its derivative, {\tt ptmalloc}, has been part of the |
129 | GNU C library for some time. However, the version we are using is not optimized for SMP and multithreading. |
129 | GNU C library for some time. However, the version we are using is not optimized for SMP and multithreading. |
130 | We plan to eventually replace it with another allocator. |
130 | We plan to eventually replace it with another allocator. |
131 | 131 | ||
132 | Finally, the {\tt pci} userspace task is using the {\tt libpci} library. The |
132 | Next, the {\tt pci} userspace task is using the {\tt libpci} library. The |
133 | library was simplified and ported to HelenOS. Even though filesystem |
133 | library was simplified and ported to HelenOS. Even though filesystem |
134 | calls were removed from the library, it still heavily depends on {\tt libc}. |
134 | calls were removed from the library, it still heavily depends on {\tt libc}. |
135 | By porting {\tt libpci} to HelenOS, we demonstrated that applications and libraries |
135 | By porting {\tt libpci} to HelenOS, we demonstrated that applications and libraries |
136 | are, given enough effort, portable to HelenOS. |
136 | are, given enough effort, portable to HelenOS. |
137 | 137 | ||
- | 138 | Finally, we demonstrated the idea presented in the previous paragraph by porting |
|
- | 139 | over 13 years old BSD game of {\tt tetris} to HelenOS. This particular version |
|
- | 140 | of tetris looks almost the same both on other people's operating systems and on HelenOS. |
|
- | 141 | Similar to {\tt libpci}, {\tt tetris} had to be modified in order to compile and run. |
|
- | 142 | The filesystem calls were removed or replaced as well as references to terminal I/O |
|
- | 143 | calls. |
|
- | 144 | ||
138 | \section{Build tools} |
145 | \section{Build tools} |
139 | Assembler, linker and compiler are by all means the very focal point of attention |
146 | Assembler, linker and compiler are by all means the very focal point of attention |
140 | of all operating system projects. Quality of these tools influences |
147 | of all operating system projects. Quality of these tools influences |
141 | operating system performance and, what is more important, stability. HelenOS has |
148 | operating system performance and, what is more important, stability. HelenOS has |
142 | been tailored to build with GNU {\tt binutils} (i.e. the assembler and linker) and GNU~{\tt gcc} |
149 | been tailored to build with GNU {\tt binutils}\cite{binutils} (i.e. the assembler and linker) and GNU~{\tt gcc}\cite{gcc} |
143 | (i.e. the compiler). There is only little chance that it could be compiled and |
150 | (i.e. the compiler). There is only little chance that it could be compiled and |
144 | linked using some other tools unless those tools are compatible with the GNU build tools. |
151 | linked using some other tools unless those tools are compatible with the GNU build tools. |
145 | 152 | ||
146 | As our project declares support for five different processor architectures, |
153 | As our project declares support for five different processor architectures, |
147 | we needed to have five different flavors of the build utilities installed. |
154 | we needed to have five different flavors of the build utilities installed. |
Line 195... | Line 202... | ||
195 | From the second point of view, we have tested these programs by our operating system. |
202 | From the second point of view, we have tested these programs by our operating system. |
196 | Because of the scope and uniqueness of this testing and because we did find some issues, |
203 | Because of the scope and uniqueness of this testing and because we did find some issues, |
197 | we want to dedicate some more space to what we have found. |
204 | we want to dedicate some more space to what we have found. |
198 | 205 | ||
199 | \subsection{Bochs} |
206 | \subsection{Bochs} |
200 | Bochs has been used to develop the SPARTAN kernel since its beginning in 2001. |
207 | Bochs\cite{bochs} has been used to develop the SPARTAN kernel since its beginning in 2001. |
201 | It is capable of emulating ia32 machine and for some time also amd64. |
208 | It is capable of emulating ia32 machine and for some time also amd64. |
202 | Bochs is an emulator and thus the slowest from virtual environments capable |
209 | Bochs is an emulator and thus the slowest from virtual environments capable |
203 | of simulating the same cathegory of hardware. On the other hand, it is extremely |
210 | of simulating the same cathegory of hardware. On the other hand, it is extremely |
204 | portable, compared to much faster virtualizers and emulators using dynamic translation |
211 | portable, compared to much faster virtualizers and emulators using dynamic translation |
205 | of instructions. Lately, there have been some plans to develop or port dynamic translation |
212 | of instructions. Lately, there have been some plans to develop or port dynamic translation |
Line 220... | Line 227... | ||
220 | simulation, but this has also proven not very useful as we often needed to debug |
227 | simulation, but this has also proven not very useful as we often needed to debug |
221 | problems that existed only in multiprocessor configurations, which {\tt gdb} |
228 | problems that existed only in multiprocessor configurations, which {\tt gdb} |
222 | does not understand. |
229 | does not understand. |
223 | 230 | ||
224 | \subsection{GXemul} |
231 | \subsection{GXemul} |
225 | GXemul is an emulator of several processor architectures. Nevertheless, we have |
232 | GXemul\cite{gxemul} is an emulator of several processor architectures. Nevertheless, we have |
226 | used it only for mips32 emulation in both little-endian and big-endian modes. |
233 | used it only for mips32 emulation in both little-endian and big-endian modes. |
227 | It seems to be pretty featurefull and evolving but we don't use all its functionality. |
234 | It seems to be pretty featurefull and evolving but we don't use all its functionality. |
228 | GXemul is very user friendly and has debugging features. It is more realistic |
235 | GXemul is very user friendly and has debugging features. It is more realistic |
229 | than msim. However, our newly introduced TLS support triggered a bug in the {\tt rdhwr} |
236 | than msim. However, our newly introduced TLS support triggered a bug in the {\tt rdhwr} |
230 | instruction emulation while msim functioned as expected. Fortunatelly, the author |
237 | instruction emulation while msim functioned as expected. Fortunatelly, the author |
231 | of GXemul is very cooperative and has fixed the problem for future versions as well as |
238 | of GXemul is very cooperative and has fixed the problem for future versions as well as |
232 | provided a quick hack for the old version. |
239 | provided a quick hack for the old version. |
233 | 240 | ||
234 | \subsection{msim} |
241 | \subsection{msim} |
235 | msim has been our first mips32 simulator. It simulates 32-bit side of R4000 processor. |
242 | msim\cite{msim} has been our first mips32 simulator. It simulates 32-bit side of R4000 processor. |
236 | Its simulated environment is not very realistic, but the processor simulation |
243 | Its simulated environment is not very realistic, but the processor simulation |
237 | is good enough for operating system development. In this regard, the simulator is |
244 | is good enough for operating system development. In this regard, the simulator is |
238 | comparable to HP's ia64 simulator Ski. Another similar aspect of these two is |
245 | comparable to HP's ia64 simulator Ski. Another similar aspect of these two is |
239 | relatively strong debugger. |
246 | relatively strong debugger. |
240 | 247 | ||
Line 243... | Line 250... | ||
243 | Curiously, this simulator contained the biggest number of defects and inaccuracies |
250 | Curiously, this simulator contained the biggest number of defects and inaccuracies |
244 | that we have ever discovered in a simulator. Fortunately, all of them have been |
251 | that we have ever discovered in a simulator. Fortunately, all of them have been |
245 | eventually fixed. |
252 | eventually fixed. |
246 | 253 | ||
247 | \subsection{PearPC} |
254 | \subsection{PearPC} |
248 | PearPC is the only emulator on which we have run ppc32 port of HelenOS. It has |
255 | PearPC\cite{pearpc} is the only emulator on which we have run ppc32 port of HelenOS. It has |
249 | no debugging features, but fortunatelly its sources are available under |
256 | no debugging features, but fortunatelly its sources are available under |
250 | an open source license. This enabled {\OP} and {\MD} to alter its sources |
257 | an open source license. This enabled {\OP} and {\MD} to alter its sources |
251 | in a way that this modified version allowed some basic debugging. |
258 | in a way that this modified version allowed some basic debugging. |
252 | 259 | ||
253 | \subsection{QEMU} |
260 | \subsection{QEMU} |
254 | QEMU emulates several processor architectures. We have used it to emulate |
261 | QEMU\cite{qemu} emulates several processor architectures. We have used it to emulate |
255 | ia32 and amd64. It can simulate SMP, but contrary to Bochs, it uses dynamic |
262 | ia32 and amd64. It can simulate SMP, but contrary to Bochs, it uses dynamic |
256 | translation of emulated instructions and performs much better because of |
263 | translation of emulated instructions and performs much better because of |
257 | that. |
264 | that. |
258 | 265 | ||
259 | This emulator seemed to realistically emulate the {\tt hlt} instruction, |
266 | This emulator seemed to realistically emulate the {\tt hlt} instruction, |
Line 264... | Line 271... | ||
264 | with {\tt gdb} can be pretty comfortable\footnote{Especially when the kernel is |
271 | with {\tt gdb} can be pretty comfortable\footnote{Especially when the kernel is |
265 | compiled with {\tt -g3}.} until one needs to debug a SMP kernel running on multiple |
272 | compiled with {\tt -g3}.} until one needs to debug a SMP kernel running on multiple |
266 | processors. |
273 | processors. |
267 | 274 | ||
268 | \subsection{Simics} |
275 | \subsection{Simics} |
269 | Virtutech's Simics simulator can be compared to a Swiss-army knife for operating system debugging. |
276 | Virtutech's Simics\cite{simics} simulator can be compared to a Swiss-army knife for operating system debugging. |
270 | This proprietary piece of software was available to us under an academic license for free. |
277 | This proprietary piece of software was available to us under an academic license for free. |
271 | 278 | ||
272 | Simics can be set to simulate many different configurations of many different machines. |
279 | Simics can be set to simulate many different configurations of many different machines. |
273 | It has the most advanced debugging features we have ever seen. To highlight some, its |
280 | It has the most advanced debugging features we have ever seen. To highlight some, its |
274 | memory access tracing ability has been really helpfull to us. During device driver |
281 | memory access tracing ability has been really helpfull to us. During device driver |
Line 282... | Line 289... | ||
282 | during application processors start. Another bugs found were related to amd64 and mips32. |
289 | during application processors start. Another bugs found were related to amd64 and mips32. |
283 | As for amd64, Simics did not report general protection fault when {\tt EFER.NXE} was 0 and a non-executable |
290 | As for amd64, Simics did not report general protection fault when {\tt EFER.NXE} was 0 and a non-executable |
284 | page was found (\#4214). As for mips32, Simics misemulated {\tt MSUB} and {\tt MSUBU} instructions. |
291 | page was found (\#4214). As for mips32, Simics misemulated {\tt MSUB} and {\tt MSUBU} instructions. |
285 | 292 | ||
286 | \subsection{Ski} |
293 | \subsection{Ski} |
287 | The ia64 port of HelenOS has been developed and debugged on the HP's IA-64 Ski simulator. |
294 | The ia64 port of HelenOS has been developed and debugged on the HP's IA-64 Ski\cite{ski} simulator. |
288 | Ski is just an Itanium processor simulator and as such does not simulate a real machine. In fact, there |
295 | Ski is just an Itanium processor simulator and as such does not simulate a real machine. In fact, there |
289 | is no firmware and no configuration tables (e.g. memory map) present in Ski! On the other hand, the missing parts can be supplied externally\footnote{This |
296 | is no firmware and no configuration tables (e.g. memory map) present in Ski! On the other hand, the missing parts can be supplied externally\footnote{This |
290 | is actually how Linux runs in this simulator.}. The simulator provides means of interaction with |
297 | is actually how Linux runs in this simulator.}. The simulator provides means of interaction with |
291 | host system devices via Simulator SystemCalls (SSC). The simulator itself has graphical interface |
298 | host system devices via Simulator SystemCalls (SSC). The simulator itself has graphical interface |
292 | with pretty powerful, but not as good as those of Simics, debugging facilities. |
299 | with pretty powerful, but not as good as those of Simics, debugging facilities. |
Line 307... | Line 314... | ||
307 | that Ski confuses VMA and LMA. This, what we believe to be a bug in Ski, has not shown in Linux since Linux always has |
314 | that Ski confuses VMA and LMA. This, what we believe to be a bug in Ski, has not shown in Linux since Linux always has |
308 | LMA equal to VMA. People from the Ski mailing list had tried to help us but our repeated problem report didn't |
315 | LMA equal to VMA. People from the Ski mailing list had tried to help us but our repeated problem report didn't |
309 | make it far enough for the HP to fix or at least clarify the issue. Finally, we adopted a workaround implemented by {\JJ} |
316 | make it far enough for the HP to fix or at least clarify the issue. Finally, we adopted a workaround implemented by {\JJ} |
310 | that simply swaps LMA and the program entry point in the kernel ELF image. |
317 | that simply swaps LMA and the program entry point in the kernel ELF image. |
311 | 318 | ||
312 | \subsection{VMware} VMware is the only virtualizer we have used in |
319 | \subsection{VMware} VMware\cite{vmware} is the only virtualizer we have used in |
313 | HelenOS development. It virtualizes the ia32 host machine. Since VMware |
320 | HelenOS development. It virtualizes the ia32 host machine. Since VMware |
314 | version 5.5, we made use of its possibility to run the guest system |
321 | version 5.5, we made use of its possibility to run the guest system |
315 | (i.e. HelenOS) on multiple processors. VMware has no support for |
322 | (i.e. HelenOS) on multiple processors. VMware has no support for |
316 | debugging but is very useful for compatibility and regression testing |
323 | debugging but is very useful for compatibility and regression testing |
317 | because it's closest to the real hardware. VMware, being a virtualizer, |
324 | because it's closest to the real hardware. VMware, being a virtualizer, |