Rev 150 | Rev 154 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\chapter{Running HelenOS}
\section{Kernel Start}
When the HelenOS kernel starts up, it configures its output device
and starts booting. During the boot process it writes out some some
lines regarding memory size and available CPUs. The userspace
drivers and tasks take over the console as soon as the start-up activity
and developer kernel tests are finished.
The console driver provides 12 virtual consoles, 11 reserved
for applications, console 12 is reserved for kernel console. Pressing
function keys F1-F12 switches between the consoles.
\section{KConsole}
KConsole is a kernel thread operating completely in priviledged mode.
It allows user to interact directly with the kernel and even start directly
functions inside the kernel.
The KConsole is shown by switching to console number 12. On some platforms
the kconsole screen is not restored to its previous contents. Press
enter to see a KConsole prompt. The function keys for switching terminals
do not work in KConsole, to switch back to other console, use
the {\em continue} command. After executing the command, press a function key
to switch to other consoles.
The basic editing facilities are very similar to {\em readline} conventions.
The left and right arrows, backspace and delete keys allow for convenient
editing of the text. The history of last ten commands can be retrieved
using up and down arrows. KConsole supports tab completion, double tab
shows a list of available commands.
The first class of commands prints useful statistics from the running
operating systems. The commands are:
\begin{description}
\item[zones] --- Prints a list of memory zones.
\item[zone $<$zone number$>$] --- Prints a detailed statistics about frame allocator.
\item[slabs] --- Prints a details statistics about slab allocator.
\item[scheduler] --- Prints scheduler queues on all cpus.
\item[threads] --- Prints list of existing threads, including information about
the thread state
\item[tasks] --- Prints list of tasks along with some basic IPC informations.
\item[ipc\_task $<$taskid$>$] --- Prints detailed information about IPC queues of a particular task.
\item[tlb] --- Prints contents of the Translation Lookaside Buffer on a processor (supported only on some platforms)
\item[exc] --- Prints table of registered exception handlers
\end{description}
Kernel contains a searchable version of its symbol table. This is used
in error processing as well as for extending functionality of KConsole.
The following commands are supported:
\begin{description}
\item[symaddr $<$address$>$] --- Finds an address in symbol table and prints appropriate
symbol name.
\item[call0, call1... $<$function$>$ $<$args...$>$] --- Calls a C function function(args...).
Note that the tab-completion works for the function names. Because
of architecture calling convention, this command does not work correctly
on the ia64 platform. The arguments can be specified
\begin{itemize}
\item as a number or hexadecimal number: call1 task\_kill 8
\item as a string: call1 printf "Hello world"
\item as a hexadecimal number preceded by '*'. The argument is then read from
the given address: call2 printf "%X" *0x8000000
\item as a symbol name. In such case the value located in the memory
in the symbols address is used: call2 printf "%d" task_counter
\item as a symbol name preceded by '\&'. The address is used.
\item as a symbol name preceded by '*'. In such a case the symbol is dereferenced.
\end{itemize}
\item[set4 <address|symbol name>] --- Saves 4-byte value on a given address.
\end{description}
The mips, ia32 and amd64 platforms provide additional commands regarding
debugging facility - set and clear hardware breakpoints and watchpoints.
\section{Emergency Functions}
It may happen that the IPC communication dies or that there appear some
problems in the communication chain
{\em keboard driver} - {\em console} - {\em output driver}.
As long that at least the keyboard driver works, pressing Escape key three
times transfers control to the KConsole immediately. Because the screen is not
updated, the user should press Enter to see the kconsole prompt.
If a kernel panic occurs, the error handling automatially switches control
to the KConsole and allows users to inspect the failed kernel online.
On the SMP system the other processors are halted immediately. The kernel
contains its symbol table, so you can probably read some useful information
about the exact place where the panic occured.
\section{How to Do a Kernel Panic}
Kernel panic is extremely rare in HelenOS. However, if the user wishes to
simulate it, KConsole contains proper commands. For example the following
command simulates a write to the unmapped address 0x4:
\begin{verbatim}
kconsole> set4 4 0
\end{verbatim}
To test the autodebugging possibilities of the IA32 platform, the following
sequence can be executed:
\begin{verbatim}
kconsole> bkpts
0. 0x80032010 in (NULL)
Count(0)
kconsole> set4 0x80032010 0
**** Found ZERO on address 0x0 ****
Reached breakpoint 0:0x8011552a(generic/src/console/cmd.o:cmd_set4)
***Type 'exit' to exit kconsole.
debug>
\end{verbatim}
\section{KLog}
To avoid disturbing the framebuffer driver with kernel messages, a circular
buffer communication between kernel and userspace area is established.
Non-critical messages are sent to the
KLog application. User can see messages about task faults
and task cleanup completion.
\section{IPCC - testing applicatoin}
To test thouroughly some aspects of the IPC and task
\section{Tetris}
Generated by GNU Enscript 1.6.6.