1,3 → 1,79 |
\chapter{Running HelenOS} |
|
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 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, if you want 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: |
- zones - Prints a list of memory zones. |
- zone <zone number> - Prints a detailed statistics about frame allocator. |
- slabs - Prints a details statistics about slab allocator. |
- scheduler - Prints scheduler queues on all cpus. |
- threads - Prints list of existing threads, including information about |
the thread state/ |
- tasks - Prints list of tasks along with some basic IPC informations. |
- ipc_tasks - Prints detailed information about IPC queues of a particular task. |
- tlb - Prints contents of the Translation Lookaside Buffer on a processor (supported only on some platforms) |
- exc - Prints table of registered exception handlers |
|
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: |
- symaddr <address> - Finds an address in symbol table and prints appropriate |
symbol name. |
- 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 |
- as a number or hexadecimal number: call1 task_kill 8 |
- as a string: call1 printf "Hello world" |
- as a hexadecimal number preceded by '*'. The argument is then read from |
the given address: call2 printf "%X" *0x8000000 |
- as a symbol name. In such case the value located in the memory |
in the symbols address is used: call2 printf "%d" task_counter |
- as a symbol name preceded by '&'. The address is used. |
- as a symbol name preceded by '*'. In such a case the symbol is dereferenced. |
- set4 <address|symbol name> - Saves 4-byte value on a given address. |
|
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 are 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. 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. |